n = int(eval(input()))

B = list(a-i for i,a in zip(list(range(1,n+1)), list(map(int,input().split()))))

B.sort()

l = r = B[n//2] # median left, right

if n%2 == 0: l -= 1 # left fix

ans_l, ans_r = 0, 0

for bi in B:

    ans_l += abs(bi-l)

    ans_r += abs(bi-r)

print((min([ans_l, ans_r])))

n = int(eval(input()))

B = list(a-i-1 for i,a in zip(list(range(n)), list(map(int,input().split()))))

B.sort()

ans = sum(B[n//2 + (n%2) :]) - sum(B[: n//2]) # sum(median left) - sum(median right)

print(ans)

n = int(eval(input()))
B = list(a - i for i, a in zip(list(range(1, n + 1)), list(map(int, input().split()))))
B.sort()
l = r = B[n // 2]  # median left, right
if n % 2 == 0:
    l -= 1  # left fix
ans_l, ans_r = 0, 0
for bi in B:
    ans_l += abs(bi - l)
    ans_r += abs(bi - r)
print((min([ans_l, ans_r])))

n = int(eval(input()))
B = list(a - i - 1 for i, a in zip(list(range(n)), list(map(int, input().split()))))
B.sort()
ans = sum(B[n // 2 + (n % 2) :]) - sum(
    B[: n // 2]
)  # sum(median left) - sum(median right)
print(ans)

-B = list(a - i for i, a in zip(list(range(1, n + 1)), list(map(int, input().split())))) +B = list(a - i - 1 for i, a in zip(list(range(n)), list(map(int, input().split())))) -l = r = B[n // 2]  # median left, right -if n % 2 == 0: -    l -= 1  # left fix -ans_l, ans_r = 0, 0 -for bi in B: -    ans_l += abs(bi - l) -    ans_r += abs(bi - r) -print((min([ans_l, ans_r]))) +ans = sum(B[n // 2 + (n % 2) :]) - sum( +    B[: n // 2] +)  # sum(median left) - sum(median right) +print(ans)