n = int(eval(input()))

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

a = []

ans = 0

for i in range(n):

    a += [ary[i] - (i+1)]

a.sort()

if n % 2 == 1:

    b = a[-(-n // 2)-1]

    for i in range(n):

        ans += abs(a[i] - b)

else:

    b = (a[n//2-1]+a[n//2])//2

    for i in range(n):

        ans += abs(a[i] - b)

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

ary = sorted([j-(i+1) for i,j in enumerate(map(int,input().split()))])

if len(ary) % 2 == 0:

    a = (ary[len(ary)//2]+ary[len(ary)//2-1])//2

    ans = 0

    for i in ary:

        ans += abs(i - a)

else:

    a = ary[len(ary)//2]

    ans = 0

    for i in ary:

        ans += abs(i - a)

print(ans)
n = int(eval(input()))
ary = list(map(int, input().split()))
a = []
ans = 0
for i in range(n):
    a += [ary[i] - (i + 1)]
a.sort()
if n % 2 == 1:
    b = a[-(-n // 2) - 1]
    for i in range(n):
        ans += abs(a[i] - b)
else:
    b = (a[n // 2 - 1] + a[n // 2]) // 2
    for i in range(n):
        ans += abs(a[i] - b)
print(ans)

n = int(eval(input()))
ary = sorted([j - (i + 1) for i, j in enumerate(map(int, input().split()))])
if len(ary) % 2 == 0:
    a = (ary[len(ary) // 2] + ary[len(ary) // 2 - 1]) // 2
    ans = 0
    for i in ary:
        ans += abs(i - a)
else:
    a = ary[len(ary) // 2]
    ans = 0
    for i in ary:
        ans += abs(i - a)
print(ans)

-ary = list(map(int, input().split())) -a = [] -ans = 0 -for i in range(n): -    a += [ary[i] - (i + 1)] -a.sort() -if n % 2 == 1: -    b = a[-(-n // 2) - 1] -    for i in range(n): -        ans += abs(a[i] - b) +ary = sorted([j - (i + 1) for i, j in enumerate(map(int, input().split()))]) +if len(ary) % 2 == 0: +    a = (ary[len(ary) // 2] + ary[len(ary) // 2 - 1]) // 2 +    ans = 0 +    for i in ary: +        ans += abs(i - a) -    b = (a[n // 2 - 1] + a[n // 2]) // 2 -    for i in range(n): -        ans += abs(a[i] - b) +    a = ary[len(ary) // 2] +    ans = 0 +    for i in ary: +        ans += abs(i - a)