n=int(input())
a=sorted([int(x) for x in input().split()])
i=1
sum1=0
sum2=0

n=n//2

for j in range(n):
    if a[j]>=i:
        sum1+=(a[j]-i)
    else:
        sum1+=(i-a[j])

    i+=2

i=2
for j in range(n):
    if a[j]>=i:
        sum2+=(a[j]-i)

    else:
        sum2+=(i-a[j])

    i+=2
    #print(sum2)

#print(sum1,sum2)

print(min(sum1,sum2))
