import java.util.*;
public class A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc1 = new Scanner(System.in);
		int n = sc1.nextInt();
		int a[] = new int[n/2];
		Stack<Integer> s = new Stack<>();
		Stack<Integer> t = new Stack<>();
		for(int i=0;i<n/2;i++) {
			a[i] = sc1.nextInt();
			s.push(a[i]);
			t.push(a[i]);
		}
		
		int x[] = new int[n+1];
		int y[] = new int[n+1];
		for(int i=1;i<=n;i++) {
			if(i%2==0) {
				x[i] = 1;
			}
		}
		for(int i=1;i<=n;i++) {
			if(i%2==1) {
				y[i] = 1;
			}
		}
		int sum1 =0;int sum2=0;
		for(int i=n;i>=1;i--) {
			if(x[i]==1) {
				sum1 = sum1 + Math.abs(i-s.pop());
			}
		}
		for(int i=n;i>=1;i--) {
			if(y[i]==1) {
				sum2 = sum2 + Math.abs(i-t.pop());
			}
		}
		System.out.println(Math.min(sum1, sum2));
		
	}

}
