import numpy as np



N = int(eval(input()))

A = np.array(list(map(int, input().split(' '))))

i = np.arange(1, N + 1)



b = int(np.median(sorted(A - i)))



print((np.sum(np.abs(A - (i + b)))))

import numpy as np



N = int(eval(input()))

A = np.array(list(map(int, input().split(' '))))



diff = A - (np.arange(N) + 1)

diff.sort()



if N % 2 == 0:

    median = (diff[N // 2] + diff[N // 2 - 1]) // 2

else:

    median = diff[N // 2]



print((np.sum(np.abs(diff - median))))

import numpy as np

N = int(eval(input()))
A = np.array(list(map(int, input().split(" "))))
i = np.arange(1, N + 1)
b = int(np.median(sorted(A - i)))
print((np.sum(np.abs(A - (i + b)))))

import numpy as np

N = int(eval(input()))
A = np.array(list(map(int, input().split(" "))))
diff = A - (np.arange(N) + 1)
diff.sort()
if N % 2 == 0:
    median = (diff[N // 2] + diff[N // 2 - 1]) // 2
else:
    median = diff[N // 2]
print((np.sum(np.abs(diff - median))))

-i = np.arange(1, N + 1) -b = int(np.median(sorted(A - i))) -print((np.sum(np.abs(A - (i + b))))) +diff = A - (np.arange(N) + 1) +diff.sort() +if N % 2 == 0: +    median = (diff[N // 2] + diff[N // 2 - 1]) // 2 +else: +    median = diff[N // 2] +print((np.sum(np.abs(diff - median))))