n=int(input())
l=[int(i) for i in input().split()]
l.sort()
l1=[0]*(n+1)
c=0
for i in range(1,n+1,2):
    # print(i)
    l1[i]=l[c]
    c+=1
# print(l1)
s=0
for i in range(1,n+1,2):
    s+=abs(i-l1[i])
# print(s)

l1=[0]*(n+1)
c=n//2-1
for i in range(n,0,-2):
    # print(i)
    l1[i]=l[c]
    c-=1
# print(l1)
s1=0
for i in range(n,0,-2):
    s1+=abs(i-l1[i])
# print(s1)
print(min(s,s1))