n = int(input())
p = [0] * (n)
for i in input().split():
    p[int(i) - 1] = 1
ans_1 = 0
ans_2 = 0
cnt = 0
for ind, i in enumerate(p):
    if i:
        ans_1 += abs(ind - (cnt * 2))
        cnt += 1
for ind, i in enumerate(p):
    if i:
        cnt += 1
        ans_2 += abs(ind - (cnt * 2))
print(min(ans_1, ans_2))