n=int(input())
v=list(map(int,input().split()))
v.sort()
even=[]
odd=[]
for x in range(1,n+1):
	if(x%2):
		odd.append(x)
	else:
		even.append(x)
a=0
b=0
for x in range(0,int(n/2)):
	a=a+abs(odd[x]-v[x])
	b=b+abs(even[x]-v[x])

if a<b:
	print(a)
else:
	print(b)