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