import java.util.*;
/*import java.util.Scanner;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;*/

public class Q1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n,i,j,temp,c1=1,t1=0,c2=2,t2=0;
        n=sc.nextInt();
        int a[]=new int[n+1];
        int b[]=new int[n+1];
        for(i=1;i<=(n/2);i++){
            temp=sc.nextInt();
            a[temp]=1;
            b[temp]=1;
        }
        for(i=1;i<=n;i++){
            //System.out.println("a[i] "+a[i]);
            if(i%2==0 && a[i]==1){
                while (c1<=n){
                    if(a[c1]==0){
                        t1+=(Math.abs(c1-i));
                        c1+=2;
                        //System.out.println("i "+i+" t1 "+t1+" c1 "+c1);
                        break;
                    }
                    else c1+=2;
                }
            }
        }
        for(i=1;i<=n;i++){
            if(i%2!=0 && a[i]==1){
                while (c2<=n){
                    if(a[c2]==0){
                        t2+=(Math.abs(c2-i));
                        c2+=2;
                        break;
                    }
                    else c2+=2;
                }
            }
        }
        System.out.println(t1>t2?t2:t1);
    }
}
