import math
# n, k = (int(x) for x in input().split())
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
even = [x * 2 + 2 for x in range(n // 2)]
odd = [x * 2 + 1 for x in range(n // 2)]

se = sum([int(math.fabs(l[i] - even[i])) for i in range(n // 2)])
so = sum([int(math.fabs(l[i] - odd[i])) for i in range(n // 2)])
# print([int(math.fabs(l[i] - even[i])) for i in range(n // 2)])
# print([int(math.fabs(l[i] - odd[i])) for i in range(n // 2)])
print(min(se, so))
