n=int(input())
a=list(map(int,input().split()))
e,o=0,0
j=(n//2)-1
a.sort()
#print(a)
for i in range(n-1,0,-2):
	if a[j]-i<0:
		o+=i-a[j]
	else:
		o+=a[j]-i
	j-=1
j=(n//2)-1
for i in range(n,1,-2):
	if a[j]-i<0:
		e+=i-a[j]
	else:
		e+=a[j]-i
	j-=1
print(min(e,o))