import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.PriorityQueue;

public class A {

	public static void main(String[] args) throws IOException {
		BufferedReader bfr = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(bfr.readLine());
		boolean board[] = new boolean[n];
		String _pos[] = bfr.readLine().split(" ");
		int pos[] = new int[n/2];
		PriorityQueue<Integer> q = new PriorityQueue<>();
		PriorityQueue<Integer> rq = new PriorityQueue<>();
		
		for(int i = 0; i < n/2; i++) {
			pos[i] = Integer.parseInt(_pos[i])-1;
			board[pos[i]] = true;
		}
		
		for(int i = 0; i < n/2; i++) {
			q.add(pos[i]);
			rq.add(pos[i]);
		}
		
		int wm = 0;
		int bm = 0;		
		
		for (int i = 0; i < n; i++) {
			//blacks
			if (i%2 == 0) {
				int nxt = q.poll();
				bm += Math.abs(i-nxt);
			} else {
				int nxt = rq.poll();
				wm += Math.abs(i-nxt);
			}
			
		}
		
		
		System.out.println(Math.min(bm, wm));
	}

}
