n=int(eval(input()))

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

for i in range(n):

  a[i]-=i

a.sort()

x=a[n//2]

ans=0

for i in range(n):

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

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

a=[int(i) for i in input().split()]

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

a.sort()

if n%2==0:

    print((sum(a[n//2:])-sum(a[0:n//2])))

else:

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

n = int(eval(input()))
a = [int(i) for i in input().split()]
a = [a[i] - (i + 1) for i in range(n)]
a.sort()
if n % 2 == 0:
    print((sum(a[n // 2 :]) - sum(a[0 : n // 2])))
else:
    print((sum(a[n // 2 + 1 :]) - sum(a[0 : n // 2])))

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