import java.io.*;
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] ar = new int[n +  1];
		
		for(int i=1; i<=n/2;i++){
			ar[scn.nextInt()]=1;
		}
		int odd = minNumbersOdd(n, ar);
		int even = minNumbersEven(n, ar);

	//	System.out.println( odd+" "+even );
		System.out.println( Math.min ( odd, even ) );
	}

	static int minNumbersOdd(int n, int[] ar){

		int rv = 0;
		boolean[] booked = new boolean[n+1];
		for(int i=1;i<=n;i++){
			if( (booked[i] && (i%2!=0 && ar[i]==1)) || (i%2==0 && ar[i]==1)){
				int left=i-1, right =i+1;
				while(left>=1 && (booked[left] || left%2==0) ){
					left--;
				}
				if(left==0)
					left = Integer.MAX_VALUE;
				while(right<=n && (right%2==0 || booked[right]) ){
					right++;
				}
				if(right>n)
					right = Integer.MAX_VALUE;
				int j = Math.min(left, right);
				rv+=Math.abs(j-i);
				booked[j]=true;	
			}else if(ar[i]==1 && i%2!=0){
				booked[i]=true;
			}
	
			
		}
		return rv;
	}

	static int minNumbersEven(int n, int[] ar){

		int rv = 0;
		boolean[] booked = new boolean[n+1];
		for(int i=1;i<=n;i++){
			if( (booked[i] && (i%2==0 && ar[i]==1)) || (i%2!=0 && ar[i]==1)){
				int left=i-1, right =i+1;
				while(left>=1 && (booked[left] || left%2!=0) ){
					left--;
				}
				if(left==0)
					left = Integer.MAX_VALUE;
				while(right<=n && (right%2!=0 || booked[right]) ){
					right++;
				}
				if(right>n)
					right = Integer.MAX_VALUE;
				int j = Math.min(left, right);
				rv+=Math.abs(j-i);
				booked[j]=true;	
			}else if(ar[i]==1 && i%2==0){
				booked[i]=true;
			}
	
			
		}
		return rv;
	}
}