N = int(eval(input()))

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

 

for i in range(N):

    A[i] -= i

 

A.sort()

 

Ans = 0

mi = len(A)//2 # 中央値のindex

for i in range(N):

    Ans += abs(A[i]-A[mi])

 

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

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

 

b = [(a[i] - i) for i in range(n)]

b.sort()

num = b[ n // 2]

 

result = 0

for i in b:

    result += abs(num - i)

 

print(result)
N = int(eval(input()))
A = list(map(int, input().split()))
for i in range(N):
    A[i] -= i
A.sort()
Ans = 0
mi = len(A) // 2  # 中央値のindex
for i in range(N):
    Ans += abs(A[i] - A[mi])
print(Ans)

n = int(eval(input()))
a = list(map(int, input().split()))
b = [(a[i] - i) for i in range(n)]
b.sort()
num = b[n // 2]
result = 0
for i in b:
    result += abs(num - i)
print(result)

-N = int(eval(input())) -A = list(map(int, input().split())) -for i in range(N): -    A[i] -= i -A.sort() -Ans = 0 -mi = len(A) // 2  # 中央値のindex -for i in range(N): -    Ans += abs(A[i] - A[mi]) -print(Ans) +n = int(eval(input())) +a = list(map(int, input().split())) +b = [(a[i] - i) for i in range(n)] +b.sort() +num = b[n // 2] +result = 0 +for i in b: +    result += abs(num - i) +print(result)