import sys

import numpy as np

n = int(eval(input()))

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



comp = np.arange(n) + 1

diff = arr - comp



diff.sort()



diff = diff - np.median(diff)



print((int(np.abs(diff).sum())))
import numpy as np



n = int(eval(input()))

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



arr = np.arange(n) + 1

diff = a - arr



diff.sort()



diff = diff - np.median(diff)



print((int(np.abs(diff).sum())))
import sys
import numpy as np

n = int(eval(input()))
arr = np.array(list(map(int, input().split())))
comp = np.arange(n) + 1
diff = arr - comp
diff.sort()
diff = diff - np.median(diff)
print((int(np.abs(diff).sum())))

import numpy as np

n = int(eval(input()))
a = np.array(list(map(int, input().split())))
arr = np.arange(n) + 1
diff = a - arr
diff.sort()
diff = diff - np.median(diff)
print((int(np.abs(diff).sum())))

-import sys -arr = np.array(list(map(int, input().split()))) -comp = np.arange(n) + 1 -diff = arr - comp +a = np.array(list(map(int, input().split()))) +arr = np.arange(n) + 1 +diff = a - arr