import java.util.Scanner;

public class A11 {
	
	public static void main (String[] args) {
		//code
		Scanner sc = new Scanner(System.in);

		int n =sc.nextInt();
		int[] ar = new int[n+1];
		for(int i=0;i<n/2;i++)
			ar[sc.nextInt()]=1;
		int ans1=0,ans2=0;
		for(int i=1;i<n+1;i++) {
			if(i%2==0 && ar[i]==1) {
				for(int j=1;j<n+1;j++) {
					if(j%2!=0 && ar[j]==0) {
						ans1+=Math.abs(i-j);ar[j]=1;break;
						
					}
				}
			}
		}
		for(int i=1;i<n+1;i++) {
			if(i%2!=0 && ar[i]==1) {
				for(int j=1;j<n+1;j++) {
					if(j%2==0 && ar[j]==0) {
						ans2+=Math.abs(i-j);ar[j]=1;break;
					}
				}
			}
		}
		System.out.println(Math.min(ans1, ans2));
		

}
}