import java.util.Scanner;

public class CF981A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int total1 = 0;
		int total2 = 0;
		for(int i=0; i<n/2; i++) {
			int c = sc.nextInt();
			int goal = (i+1)*2;
			total1+=Math.abs(c-(goal-1));
			total2+=Math.abs(c-goal);
		}
		System.out.println(Math.min(total1, total2));
	}
}
