n=int(eval(input()))

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



for i in range(n):

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



from statistics import mean, median,variance,stdev

z=int(median(l))



x=0

for j in range(n):

    x+=abs(l[j]-z)



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

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



l=[l[i]-(i+1) for i in range(n)]



from statistics import median

z=int(median(l))



x=0

for j in range(n):

    x+=abs(l[j]-z)



print(x)
n = int(eval(input()))
l = list(map(int, input().split()))
for i in range(n):
    l[i] = l[i] - (i + 1)
from statistics import mean, median, variance, stdev

z = int(median(l))
x = 0
for j in range(n):
    x += abs(l[j] - z)
print(x)

n = int(eval(input()))
l = list(map(int, input().split()))
l = [l[i] - (i + 1) for i in range(n)]
from statistics import median

z = int(median(l))
x = 0
for j in range(n):
    x += abs(l[j] - z)
print(x)

-for i in range(n): -    l[i] = l[i] - (i + 1) -from statistics import mean, median, variance, stdev +l = [l[i] - (i + 1) for i in range(n)] +from statistics import median