import java.util.Scanner;
public class a {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean[] oc = new boolean[n];
		for(int i=0;i<n/2;i++) {
			int temp = sc.nextInt()-1;
			oc[temp]=true;
		}
		int start=0;
		int end=n-1;
		while(true) {
			if(oc[start]==true)
				break;
			start++;
		}
		while(true) {
			if(oc[end]==true)
				break;
			end--;
		}
		int front =0;
		int behind =0;
		for(int i=0;i<n/2;i++)
			if(oc[i])
				front++;
		for(int i=0;i<n/2;i++)
			if(oc[n-1-i])
				behind++;
		int result;
		if(behind>front) {
			result =behind(n,oc,start);
		}
		else {
			result = front(n,oc,end);
		}
		
		System.out.println(result);
	}

	public static int behind(int n,boolean[] oc,int start) {
		int result = 0;
		for(int i=0;i<n/2;i++) {
			int here = 2*i+1;
			result+=Math.abs(here-start);
			start++;
			boolean done = true;
			if(i==n/2-1)
				done = false;
			while(done) {
				if(oc[start]==true)
					break;
				start++;
			}
		}
		return result;
	}
	public static int front(int n,boolean[] oc,int end) {
		int result = 0;
		for(int i=0;i<n/2;i++) {
			int here = (n-1)-2*i-1;
			result+=Math.abs(here-end);
			end--;
			boolean done = true;
			if(i==n/2-1)
				done=false;
			while(done) {
				if(oc[end]==true)
					break;
				end--;
			}
	
		}
		return result;
	}
}
