import java.util.*;
public class Main {      
    public static void main(String args[])  {
        Scanner sc =new Scanner(System.in);
        
        int a=sc.nextInt();
        int t1=1;
        int t2=2;
        int res1=0;
        int res2=0;
        for(int n=0;n<a/2;n++){
        	int x=sc.nextInt();
        	res1+=Math.abs(x-t1);
        	res2+=Math.abs(x-t2);
        	t1+=2;
        	t2+=2;
        }
        System.out.println(Math.min(res1, res2));
    }  
}