import math

n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
ans1 = 0
ans2 = 0
for i in range(n//2):
    ans1 += math.fabs(a[i] - (i * 2 + 1))
    ans2 += math.fabs(a[i] - (i * 2 + 2))
print(int(min(ans1,ans2)))