n = int(input())
arr = [int(i) for i in input().strip().split()]
arr.sort()
brr = [i for i in arr]
ans = 0 
for i in range(n, 0, -2):
    ele = arr.pop()
    ans += abs(i-ele)

ans2 = 0
for i in range(n-1, 0, -2):
    ele = brr.pop()
    ans2 += abs(i-ele)

print(min(ans, ans2))
