i1=int(input())
ar=list(map(int,input().split()))
sm1=0
sm2=0
ar.sort()
for i in range(1,i1,2):
    sm2+=abs(i-ar[int(i/2)])
ar.sort(reverse=True)
for i in range(0,i1,2):
    sm1+=abs(i1-i-ar[int(i/2)])
print(min(sm1,sm2))