n = int(input())
tab = list(map(int, input().split()))
tab.sort()
tot = [0, 0]
for i in range(n//2):
    tot[0] += abs((n-i*2) - tab[-1-i])
    tot[1] += abs((n-i*2-1) - tab[-1-i])
print(min(tot[0], tot[1]))