N = int(eval(input()))

A = list(map(int,input().split()))

tmp = []

for i in range(N):

  tmp.append(A[i] - (i+1))

tmp.sort()

mid = tmp[int(N/2)]

ans = 0

for i in range(N):

  ans += abs(tmp[i] - mid)

print(ans)
N = int(eval(input()))

A = list(map(int,input().split()))

tmp = sorted([A[i-1] - i for i in range(1, N+1)])

mid = tmp[int(N/2)]

print((sum([abs(t - mid) for t in tmp])))
N = int(eval(input()))
A = list(map(int, input().split()))
tmp = []
for i in range(N):
    tmp.append(A[i] - (i + 1))
tmp.sort()
mid = tmp[int(N / 2)]
ans = 0
for i in range(N):
    ans += abs(tmp[i] - mid)
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
tmp = sorted([A[i - 1] - i for i in range(1, N + 1)])
mid = tmp[int(N / 2)]
print((sum([abs(t - mid) for t in tmp])))

-tmp = [] -for i in range(N): -    tmp.append(A[i] - (i + 1)) -tmp.sort() +tmp = sorted([A[i - 1] - i for i in range(1, N + 1)]) -ans = 0 -for i in range(N): -    ans += abs(tmp[i] - mid) -print(ans) +print((sum([abs(t - mid) for t in tmp])))