n = int(eval(input()))

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

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



import statistics

b = int(statistics.median(a))

ans = sum([abs(i-b) for i in a])

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

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

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

b = sorted(a)[int(n/2)]

print((sum([abs(i-b) for i in a])))
n = int(eval(input()))
a = list(map(int, input().split()))
a = [a[i] - (i + 1) for i in range(len(a))]
import statistics

b = int(statistics.median(a))
ans = sum([abs(i - b) for i in a])
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
a = [a[i] - (i + 1) for i in range(len(a))]
b = sorted(a)[int(n / 2)]
print((sum([abs(i - b) for i in a])))

-import statistics - -b = int(statistics.median(a)) -ans = sum([abs(i - b) for i in a]) -print(ans) +b = sorted(a)[int(n / 2)] +print((sum([abs(i - b) for i in a])))