n = int(input())
p = list(map(int, input().split()))

p = list(sorted(p))

ans = n * n
for i in range(1, 3):
    cnt = 0
    for j in range(n // 2):
        cnt += abs(2 * j + i - p[j])
    ans = min(ans, cnt)

print(ans)
