import java.io.*;
import java.util.*;
public class Edu44a
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	public static void main(String[] args) throws IOException {
		new Edu44a().run();
	}
	void run() throws IOException {
		//in=new BufferedReader(new FileReader("input.txt"));
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		int n = ni();
		boolean vis1[] = new boolean[n+1];
		for(int i=1 ; i<=n/2 ; i++)
			vis1[ni()] = true;
		int odd = 0 , even = 0;
		{
			boolean vis[] = new boolean[n+1];
			for(int i=1 ; i<=n ; i++) vis[i] = vis1[i];

			while(true)
			{
				int flag = 0;
				for(int i=1; i<=n ; i++) {
					if(vis[i]==true && i%2!=0) {
						flag = 1;break;
					}
				}
				if(flag==0) break;
				for(int i=1 ; i<=n ; i++) {
					if(vis[i]==true && i%2!=0) {
						int min = Integer.MAX_VALUE , index = -1;
						for(int k=1 ; k<=n ; k++) {
							if(k%2==0 && !vis[k]) {
								int dist = Math.abs(k-i);
								if( dist<min ) {
									min = dist;
									index = k;
								}
							}
						}
						if(index!=-1) {
							vis[i] = false;
							vis[index] = true;
							even+=min;
						}
					}	
				}
			}
		}
		{
			boolean vis[] = new boolean[n+1];
			for(int i=1 ; i<=n ; i++) vis[i] = vis1[i];
			while(true)
			{
				int flag = 0;
				for(int i=1; i<=n ; i++) {
					if(vis[i]==true && i%2==0) {
						flag = 1;break;
					}
				}
				if(flag==0) break;
				for(int i=1 ; i<=n ; i++) {
					if(vis[i]==true && i%2==0) {
						int min = Integer.MAX_VALUE , index = -1;
						for(int k=1 ; k<=n ; k++) {
							if(k%2!=0 && !vis[k]) {
								int dist = Math.abs(k-i);
								if( dist<min ) {
									min = dist;
									index = k;
								}
							}
						}
						if(index!=-1) {
							vis[i] = false;
							vis[index] = true;
							odd+=min;
						}
					}	
				}
			}	
		}
		ob.println(Math.min(even , odd));
	}
	String ns() throws IOException {
		return nextToken();
	}
	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	} 
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int[] nia(int start,int b) throws IOException {
		int a[]=new int[b];
		for(int i=start;i<b;i++)
			a[i]=ni();
		return a;
	}
	long[] nla(int start,int n) throws IOException {
		long a[]=new long[n];
		for (int i=start; i<n ;i++ ) {
			a[i]=nl();
		}
		return a;
	}
}