N = int(eval(input()))

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



blist = []

for i in range(N):

    blist.append(alist[i]-i-1)



blist.sort()

mid = blist[len(blist)//2]



ans = 0



for i in range(N):

    ans += abs(blist[i]-mid)



print(ans)

N = int(eval(input()))

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



blist = []



for i in range(N):

    blist.append(alist[i]-i-1)



blist.sort()

mid = blist[N//2]



print((sum([abs(b-mid) for b in blist])))

N = int(eval(input()))
alist = list(map(int, input().split()))
blist = []
for i in range(N):
    blist.append(alist[i] - i - 1)
blist.sort()
mid = blist[len(blist) // 2]
ans = 0
for i in range(N):
    ans += abs(blist[i] - mid)
print(ans)

N = int(eval(input()))
alist = list(map(int, input().split()))
blist = []
for i in range(N):
    blist.append(alist[i] - i - 1)
blist.sort()
mid = blist[N // 2]
print((sum([abs(b - mid) for b in blist])))

-mid = blist[len(blist) // 2] -ans = 0 -for i in range(N): -    ans += abs(blist[i] - mid) -print(ans) +mid = blist[N // 2] +print((sum([abs(b - mid) for b in blist])))