n = int(input())
p = list(map(int, input().split()))

p.sort()

even = []
odd = []
for i in range(1, n + 1):
    if i % 2 == 0:
        even.append(i)
    else:
        odd.append(i)

odd_ans = 0
even_ans = 0
for i in range(n // 2):
    odd_ans += abs(p[i] - odd[i])
    even_ans += abs(p[i] - even[i])

print(min(even_ans, odd_ans))
