n = int(input())
a = sorted(map(int, input().split()))
ans1, ans2 = 0, 0
for i, x in enumerate(a):
    print(i*2+1, (i+1)*2)
    ans1 += abs(i*2+1 - x)
    ans2 += abs((i+1)*2 - x)

print(min(ans1, ans2))
