from sys import stdin

rints = lambda: [int(x) for x in stdin.readline().split()]
n, a, ans = int(input()), sorted(rints()), [0, 0]

for i in range(n):
    ans[i % 2] += abs(a[i >> 1] - (i + 1))

print(min(ans))
