n=input()
i=1
odd=[]
even=[]
odd_val=0
even_val=0
while(i<=n):
	odd.append(i)
	even.append(i+1)
	i=i+2


inp=map(int,raw_input().split())


for m in range(n/2):
	odd_val=odd_val+abs(inp[m]-odd[m])
	even_val=even_val+abs(inp[m]-even[m])

print min(odd_val,even_val)


