n=int(input())
arr=[int(x) for x in input().split()]
moves1=0
moves2=0
arr.sort()
count=(n//2)-1
for i in range(n,0,-1):
    if i%2==0:
        moves1+=abs(i-arr[count])
    else:
        moves2+=abs(i-arr[count])
        count-=1
print (min(moves1,moves2))
        
