n = int(input())
l = [int(i) for i in input().split()]
l.sort()

def f(r):
    i = 0
    d = 0
    for j in r:
        d += abs(j - l[i])
        i += 1
    return d

print(min(f(range(1, n+1, 2)), f(range(2, n+1, 2))))

