import java.util.*;
import java.io.*;
import java.math.*;
public class codeforce{
    
    public static void main(String[] args) throws IOException{
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n==2) {
            int u = sc.nextInt();
            System.out.println("0");
        }
        else{
            int f=0,z=0;
            for(int i=1;i<n;i+=2){
                int p = sc.nextInt();
                f += Math.abs(i-p);
                z += Math.abs(i+1-p);
            }
            System.out.println(Math.min(z,f));
        }
    }
    
}