import math
a=0
b=0
n=int(input())
arr=list(map(int,input().split()))
a1=[]
a2=[]
for i in range(1,n+1):
    if i%2==0:
        a2.append(i)
    else:
        a1.append(i)
for i in range(len(arr)):
    a+=abs(arr[i]-a1[i])
for i in range(len(arr)):
    b+=abs(arr[i]-a2[i])
print(min(a,b))
    
