import statistics

N = int(eval(input()))

A = [int(a)-i-1 for i,a in enumerate(input().split(),1)]

b = statistics.median_low(A)

c = statistics.median_high(A)

d = sum([abs(x-b) for x in A])

e = sum([abs(x-c) for x in A])

print((min(d,e)))
N=int(eval(input()))

A=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))

print((sum(abs(a-A[N//2]) for a in A)))
import statistics

N = int(eval(input()))
A = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)]
b = statistics.median_low(A)
c = statistics.median_high(A)
d = sum([abs(x - b) for x in A])
e = sum([abs(x - c) for x in A])
print((min(d, e)))

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

-import statistics - -A = [int(a) - i - 1 for i, a in enumerate(input().split(), 1)] -b = statistics.median_low(A) -c = statistics.median_high(A) -d = sum([abs(x - b) for x in A]) -e = sum([abs(x - c) for x in A]) -print((min(d, e))) +A = sorted(a - i - 1 for i, a in enumerate(map(int, input().split()))) +print((sum(abs(a - A[N // 2]) for a in A)))