import sys
readline = sys.stdin.readline

N = int(readline())
P = list(map(lambda x: int(x) - 1, readline().split()))
P.sort()
inf = 10**18
res = inf

for geta in range(2):
    cnt = 0
    for i in range(N//2):
        cnt += abs(P[i] - (2*i+geta))
    res = min(res, cnt)
print(res)