import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ChessPlacing {
	public static void main(String[] args) throws IOException{
		BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
		String a=r.readLine();
		int b=Integer.parseInt(a);
		a=r.readLine();
		String[] info=a.split(" ");
		int[] inf=new int[b/2];
		for(int z=0; z<b/2; z++)
			inf[z]=Integer.parseInt(info[z]);
		int black=0;
		int white=0;
		for(int z=0; z<b/2; z++){
			black+=Math.abs(inf[z]-(2*z+1));
			white+=Math.abs(inf[z]-(2*z+2));
		}
		int ans=(int)Math.min(black, white);
		System.out.println(ans);
	}
}
