N = int(input())
chess = list(map(int, input().split()))
chess.sort()
steps1 = 0
steps2 = 0
for i in range(N, 1, -2):
    steps1 += abs(chess[int(i/2)-1]-i)
for i in range(N-1, 0, -2):
    steps2 += abs(chess[i//2]-i)
print(min(steps1, steps2))
