n = int(eval(input()))

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

c = []



for i in range(n):

    c.append(a[i] - (i + 1))



c.sort()

ave = c[n//2]





ans = 10**9*n



for b in range(ave-100, ave+100):

    t = 0

    for i in range(n):

        t += abs(c[i]-b)

    ans = min(ans, t)



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

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



for i in range(n):

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



a.sort()



if n % 2 == 1:

    median = a[n // 2]

else:

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



ans = 0

for i in range(n):

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



print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
c = []
for i in range(n):
    c.append(a[i] - (i + 1))
c.sort()
ave = c[n // 2]
ans = 10**9 * n
for b in range(ave - 100, ave + 100):
    t = 0
    for i in range(n):
        t += abs(c[i] - b)
    ans = min(ans, t)
print(ans)

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

-c = [] -    c.append(a[i] - (i + 1)) -c.sort() -ave = c[n // 2] -ans = 10**9 * n -for b in range(ave - 100, ave + 100): -    t = 0 -    for i in range(n): -        t += abs(c[i] - b) -    ans = min(ans, t) +    a[i] = a[i] - (i + 1) +a.sort() +if n % 2 == 1: +    median = a[n // 2] +else: +    median = (a[n // 2 - 1] + a[n // 2]) // 2 +ans = 0 +for i in range(n): +    ans += abs(a[i] - median)