n = int(input())
pp = list(map(int, input().split()))
pp = sorted(pp)

ans = 10000
for x in range(1, 3):
    cnt = 0
    for i in range(0, int(n/2)):
        p = pp[i]
        q = x + i * 2
        cnt += abs(p - q)

    ans = min(ans, cnt)
print(ans)
