n = int(input())
p = list(map(int, input().split()))
p.sort()
a,b = 0,0
offset = 1
for i in range(n // 2):
    a += abs(p[i] - offset)
    b += abs(p[i] - (offset + 1))
    offset += 2

print(min(a,b))
