import java.math.BigInteger;
import java.util.*;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int N, M, K;
	
	public static void main(String[] args) {
		N = sc.nextInt();
		int a = 0, b = 0;
		for (int i = 1; i <= N/2; i++) {
			int v = sc.nextInt();
			a += Math.abs((i*2-1) - v);
			b += Math.abs((i*2) - v);
		}
		System.out.println(Math.min(a, b));
		System.exit(0);
	}

}

