n = int(input())
pi = list(map(int,input().split()))
pi.sort()
pi2 = [0]*(n//2)
for i in range(n//2):
    pi2[i] = pi[i]
ans = 0
for i in range(n//2):
    i = i * 2
    ans += abs((pi[i//2]-1)-i)
ans2 = 0
for i in range(n//2):
    i = i * 2 + 1
    ans2 += abs(i-(pi2[i//2]-1))
print(min(ans,ans2))
