import java.util.*;

public class chessPlacing {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int size = in.nextInt();
        int odd = 0, even = 0;
        for (int i = 0; i < size/2; i++) {
            int temp = in.nextInt();
            odd += Math.abs(temp - (i*2+1));
            even += Math.abs(temp - (i*2+2));
        }
        System.out.print(Math.min(odd, even));
    }
}
