N = int(input())
a = list(map(int, input().split()))
a = sorted(a)
num1 = 0
num2 = 0
for i in range(N // 2):
    num1 += abs(a[i] - (2 * i + 2))
    num2 += abs(a[i] - (2 * i + 1))
print(min(num1, num2))