

import java.io.*;
import java.util.*;
import java.math.*;

public class Test10{
    public static void main(String[] z) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(), j=0, k=0;
        int[] m = new int[a/2];
        for(int q=0; q<a/2; q++) m[q]=s.nextInt();
        for(int q=0; q<a/2; q++) {j+=Math.abs(m[q]-2*q-1); k+= Math.abs(m[q]-2*q-2);}
        System.out.println(Math.min(j,k));
    }
}