import java.util.*;

public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);

       int n = sc.nextInt();

       int[] arr = new int[n / 2];

       for(int i = 0;i < n / 2;i++)
           arr[i] = sc.nextInt();

       int w = 0, b = 0;
       for(int i = 0;i < n / 2;i++) {
            w += Math.abs(arr[i] - (i * 2 + 1));
            b += Math.abs(arr[i] - ((i + 1) * 2));
       }

        System.out.println(Math.min(w, b));
    }
}
