n = int(input())
mas = list(map(int, input().split()))
mas.sort()
k = 0
j = 0
delta = 1
for i in range(n//2):
    k += abs(mas[i] - delta)
    delta += 2
delta = 2
for i in range(n//2):
    j += abs(mas[i] - delta)
    delta += 2
print(min(j, k))