N=int(eval(input()))

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

A=[a-i for i,a in enumerate(A,1)]

A.sort()

A_posi=[0 for i in range(N)]

A_posi[0]=A[0]

for i in range(1,N):

    A_posi[i]=A_posi[i-1]+A[i]

value=[0 for i in range(N)]

value[0]=A_posi[N-1]-N*A[0]

for i in range(1,N):

    value[i]=A_posi[N-1]-A_posi[i]-(N-i-1)*A[i]-A_posi[i-1]+(i)*A[i]

print((min(value)))

N=int(eval(input()))

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

A=[a-i for i,a in enumerate(A,1)]

A.sort()

b=A[len(A)//2]

A=[abs(a-b) for a in A]

print((sum(A)))

N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i for i, a in enumerate(A, 1)]
A.sort()
A_posi = [0 for i in range(N)]
A_posi[0] = A[0]
for i in range(1, N):
    A_posi[i] = A_posi[i - 1] + A[i]
value = [0 for i in range(N)]
value[0] = A_posi[N - 1] - N * A[0]
for i in range(1, N):
    value[i] = (
        A_posi[N - 1] - A_posi[i] - (N - i - 1) * A[i] - A_posi[i - 1] + (i) * A[i]
    )
print((min(value)))

N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i for i, a in enumerate(A, 1)]
A.sort()
b = A[len(A) // 2]
A = [abs(a - b) for a in A]
print((sum(A)))

-A_posi = [0 for i in range(N)] -A_posi[0] = A[0] -for i in range(1, N): -    A_posi[i] = A_posi[i - 1] + A[i] -value = [0 for i in range(N)] -value[0] = A_posi[N - 1] - N * A[0] -for i in range(1, N): -    value[i] = ( -        A_posi[N - 1] - A_posi[i] - (N - i - 1) * A[i] - A_posi[i - 1] + (i) * A[i] -    ) -print((min(value))) +b = A[len(A) // 2] +A = [abs(a - b) for a in A] +print((sum(A)))