/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		int i,j,k,t=1,n,x,f,g;
		long an,ff;
		Scanner sc=new Scanner(System.in);
	//	t=sc.nextInt();
		while(t-->0){
		    n=sc.nextInt();
		    k=n/2;
		    j=1;g=2;
		     an=0;ff=0;
		    while(k-->0){
		        x=sc.nextInt();
		        an=an+Math.abs(x-j);
		        ff=ff+Math.abs(x-g);
		        j+=2;g+=2;
		        
		    }
		   // System.out.println(ff);
		    if(an>ff)
		        an=ff;
		    System.out.print(an);
		    
		}
		
	}
}
