from heapq import heappush,heappop
n=int(input())
u0,u1=1,2
m0,m1=0,0
a=[]
for i in input().split():
    heappush(a,int(i))
for i in range(n//2):
    i=heappop(a)
    m0+=abs(i-u0)
    u0+=2
    m1+=abs(i-u1)
    u1+=2
print(min(m0,m1))