from numpy import*;n,*a=list(map(int,open(0).read().split()));x=sorted(array(a)-arange(1,n+1));print((sum(abs(x-x[n//2]))))
eval(input());a=sorted(int(x)-i for i,x in enumerate(input().split()));print((sum(abs(i-a[len(a)//2])for i in a)))
from numpy import *

n, *a = list(map(int, open(0).read().split()))
x = sorted(array(a) - arange(1, n + 1))
print((sum(abs(x - x[n // 2]))))

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

-from numpy import * - -n, *a = list(map(int, open(0).read().split())) -x = sorted(array(a) - arange(1, n + 1)) -print((sum(abs(x - x[n // 2])))) +eval(input()) +a = sorted(int(x) - i for i, x in enumerate(input().split())) +print((sum(abs(i - a[len(a) // 2]) for i in a)))