N=int(eval(input()))

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

B=[]

for i in range(N):

  B.append(A[i]-i-1)

B.sort()

if N%2==0:

  b=(B[N//2]+B[N//2-1])//2

else:

  b=B[N//2]

sad=0

for j in range(N):

  sad=sad+abs(B[j]-b)

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

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

B=A

for i in range(N):

  B[i]-=i+1

C=sorted(B)

if N%2==0:

  b=(C[int(N/2-1)]+C[int(N/2)])//2

else:

  b=C[int((N-1)/2)]

ans=0

for i in range(N):

  ans+=abs(C[i]-b)

print(ans)
N = int(eval(input()))
A = list(map(int, input().split()))
B = []
for i in range(N):
    B.append(A[i] - i - 1)
B.sort()
if N % 2 == 0:
    b = (B[N // 2] + B[N // 2 - 1]) // 2
else:
    b = B[N // 2]
sad = 0
for j in range(N):
    sad = sad + abs(B[j] - b)
print(sad)

N = int(eval(input()))
A = list(map(int, input().split()))
B = A
for i in range(N):
    B[i] -= i + 1
C = sorted(B)
if N % 2 == 0:
    b = (C[int(N / 2 - 1)] + C[int(N / 2)]) // 2
else:
    b = C[int((N - 1) / 2)]
ans = 0
for i in range(N):
    ans += abs(C[i] - b)
print(ans)

-B = [] +B = A -    B.append(A[i] - i - 1) -B.sort() +    B[i] -= i + 1 +C = sorted(B) -    b = (B[N // 2] + B[N // 2 - 1]) // 2 +    b = (C[int(N / 2 - 1)] + C[int(N / 2)]) // 2 -    b = B[N // 2] -sad = 0 -for j in range(N): -    sad = sad + abs(B[j] - b) -print(sad) +    b = C[int((N - 1) / 2)] +ans = 0 +for i in range(N): +    ans += abs(C[i] - b) +print(ans)