n=int(eval(input()));a=sorted(int(x)-i for i,x in enumerate(input().split()));print((sum(abs(i-a[n//2])for i in a)))
_,a=open(0);a=sorted(int(x)-i for i,x in enumerate(a.split()));print((sum(abs(i-a[len(a)//2])for i in a)))
n = int(eval(input()))
a = sorted(int(x) - i for i, x in enumerate(input().split()))
print((sum(abs(i - a[n // 2]) for i in a)))

_, a = open(0)
a = sorted(int(x) - i for i, x in enumerate(a.split()))
print((sum(abs(i - a[len(a) // 2]) for i in a)))

-n = int(eval(input())) -a = sorted(int(x) - i for i, x in enumerate(input().split())) -print((sum(abs(i - a[n // 2]) for i in a))) +_, a = open(0) +a = sorted(int(x) - i for i, x in enumerate(a.split())) +print((sum(abs(i - a[len(a) // 2]) for i in a)))