n = int(eval(input()))

A = [int(i) for i in input().split()]

B = []



for i in range(n):

    b = A[i] - ( i + 1)

    B.append(b)

    

B.sort()

ans = 0

for i in range(n):

    ans += abs(A[i] - (B[len(B) // 2] + i + 1))



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

A = [int(i) for i in input().split()]

M = []



for i in range(n):

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

    

M.sort()

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



ans = 0

for i in range(n):

    ans += abs(A[i] - (b + i + 1))

    

print(ans)
n = int(eval(input()))
A = [int(i) for i in input().split()]
B = []
for i in range(n):
    b = A[i] - (i + 1)
    B.append(b)
B.sort()
ans = 0
for i in range(n):
    ans += abs(A[i] - (B[len(B) // 2] + i + 1))
print(ans)

n = int(eval(input()))
A = [int(i) for i in input().split()]
M = []
for i in range(n):
    M.append(A[i] - (i + 1))
M.sort()
b = M[len(M) // 2]
ans = 0
for i in range(n):
    ans += abs(A[i] - (b + i + 1))
print(ans)

-B = [] +M = [] -    b = A[i] - (i + 1) -    B.append(b) -B.sort() +    M.append(A[i] - (i + 1)) +M.sort() +b = M[len(M) // 2] -    ans += abs(A[i] - (B[len(B) // 2] + i + 1)) +    ans += abs(A[i] - (b + i + 1))