a=int(input())
l=list(map(int,input().split()))
lw=[]
lb=[]
for i in range(0,a,2):
    lb.append(i+1)
for i in range(1,a,2):
    lw.append(i+1)
x,y=0,0
for i in range(len(l)):
    x+=abs(lb[i]-l[i])
    y+=abs(lw[i]-l[i])
print(min(x,y))
