n = int(raw_input())
positions = sorted(map(int,raw_input().split()))

t1 = sum([abs(positions[i]-(1+2*i)) for i in range(n/2)])
t2 = sum([abs(positions[i]-(2+2*i)) for i in range(n/2)])
print min(t1,t2)

