import numpy as np



N=int(eval(input()))

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



AA=[]

for i,a in enumerate(A):

    AA.append(a-i+1)



b=np.median(AA)

ans=0



for a in AA:

    ans+=abs(a-b)

print((int(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:

    b=B[N//2]

else:

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

ans=0

for k in B:

    ans+=abs(k-b)

print(ans)
import numpy as np

N = int(eval(input()))
A = list(map(int, input().split()))
AA = []
for i, a in enumerate(A):
    AA.append(a - i + 1)
b = np.median(AA)
ans = 0
for a in AA:
    ans += abs(a - b)
print((int(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:
    b = B[N // 2]
else:
    b = (B[N // 2] + B[N // 2 - 1]) // 2
ans = 0
for k in B:
    ans += abs(k - b)
print(ans)

-import numpy as np - -AA = [] -for i, a in enumerate(A): -    AA.append(a - i + 1) -b = np.median(AA) +B = [] +for i in range(N): +    B.append(A[i] - i - 1) +B.sort() +if N % 2: +    b = B[N // 2] +else: +    b = (B[N // 2] + B[N // 2 - 1]) // 2 -for a in AA: -    ans += abs(a - b) -print((int(ans))) +for k in B: +    ans += abs(k - b) +print(ans)