import java.util.ArrayList;
import java.util.Scanner;

public class ChessPlacing {
	public static void main(String[] args) {
		
		Scanner sc=new Scanner(System.in);
		int num=0;
		num= sc.nextInt();
		if (num%2==0) {
		boolean []arr = new boolean[num];
		int m;
		ArrayList<Integer> l = new ArrayList<>();
		for(int i =0 ; i <num/2 ; i++) {
			m=sc.nextInt();
			l.add(m);
			
		}

		int blackcount=0 ; 
		int whitecount=0;
		
		for (int i=0 ; i< l.size() ; i++) {
			arr[l.get(i)-1]=true;
		}
		int pos=arr.length-2;
		boolean []barr = new boolean[num];
		for (int i=arr.length-1 ; i>=0 ; i--) {
			if (arr[i]==true) {barr[pos]=true;  
			blackcount=blackcount+Math.abs(pos-i);
			pos=pos-2;
			}
		}
		
		int posw=arr.length-1;
		boolean []warr = new boolean[num];
		for (int i=arr.length-1 ; i>=0 ; i--) {
			if (arr[i]==true) {warr[posw]=true;  
			whitecount=whitecount+Math.abs(posw-i);
			posw=posw-2;
			}
		}
		
		System.out.println(Math.min(blackcount ,whitecount));

		
		}
		
		
	}
	

}
