n = int(eval(input()))

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



import statistics

check = []

for i in range(n):

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

check = sorted(check)

b = statistics.median(check)



ans = 0

for i in range(n):

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

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

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



import statistics

check = []

for i in range(n):

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

b = statistics.median(sorted(check))



ans = 0

for i in range(n):

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

print((int(ans)))
n = int(eval(input()))
a = [int(i) for i in input().split()]
import statistics

check = []
for i in range(n):
    check.append(a[i] - (i + 1))
check = sorted(check)
b = statistics.median(check)
ans = 0
for i in range(n):
    ans += abs(a[i] - (b + i + 1))
print((int(ans)))

n = int(eval(input()))
a = [int(i) for i in input().split()]
import statistics

check = []
for i in range(n):
    check.append(a[i] - (i + 1))
b = statistics.median(sorted(check))
ans = 0
for i in range(n):
    ans += abs(check[i] - b)
print((int(ans)))

-check = sorted(check) -b = statistics.median(check) +b = statistics.median(sorted(check)) -    ans += abs(a[i] - (b + i + 1)) +    ans += abs(check[i] - b)