import statistics



N = int(eval(input()))

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

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



b = statistics.median(A)

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

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

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

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



b = A[(N - 1)//2]

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

print(ans)
import statistics

N = int(eval(input()))
A = list(map(int, input().split()))
A = [a - i for i, a in enumerate(A, 1)]
b = statistics.median(A)
ans = int(sum([abs(a - b) for a in A]))
print(ans)

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

-import statistics - -A = [a - i for i, a in enumerate(A, 1)] -b = statistics.median(A) -ans = int(sum([abs(a - b) for a in A])) +A = sorted([a - i for i, a in enumerate(A, 1)]) +b = A[(N - 1) // 2] +ans = sum([abs(a - b) for a in A])