n=int(eval(input()))

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

dp=[0]*n

for i in range(n):

  dp[i]=a[i]-i

dp.sort()

ans=0

for j in range(n):

  ans+=abs(dp[j]-dp[n//2])

print(ans)

n=int(eval(input()))

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

dp=[0]*n

for i in range(n):

  dp[i]=a[i]-i

dp.sort()

print((sum(abs(x-dp[n//2]) for x in dp)))
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [0] * n
for i in range(n):
    dp[i] = a[i] - i
dp.sort()
ans = 0
for j in range(n):
    ans += abs(dp[j] - dp[n // 2])
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
dp = [0] * n
for i in range(n):
    dp[i] = a[i] - i
dp.sort()
print((sum(abs(x - dp[n // 2]) for x in dp)))

-ans = 0 -for j in range(n): -    ans += abs(dp[j] - dp[n // 2]) -print(ans) +print((sum(abs(x - dp[n // 2]) for x in dp)))