import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution { 
 
   
 public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int i,cnt1=0,cnt2=0,sum=0,sub=0,m=0,sum1=0,sum2=0;
        int n= in.nextInt();
     int a[]=new int[n];
    for(i=0;i<n/2;++i)
    {
        a[i]=in.nextInt();
        if(a[i]%2==0)
            ++cnt1;
        else
            ++cnt2;
    }
    
         for(m=n,sum=0,i=(n/2-1);m>=2;m=m-2,i=i-1)
         {
              sub=a[i]-m;
             sub=Math.abs(sub);
             sum=sum+sub;
         }
          sum1=sum;   
      for(m=n-1,sum=0,i=(n/2-1);m>=1;m=m-2,i=i-1)
         {
              sub=a[i]-m;
               sub=Math.abs(sub);
             sum=sum+sub;   
         }
      sum2=sum;
     
     
     if(sum1>sum2)
     System.out.println(sum2);
     else if(sum1<sum2)
         System.out.println(sum1);
    
   }
}
