/*package whatever //do not write package name here */

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

public class Main {
	public static void main (String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    int arr[] = new int[n/2];
	    int aaq[] = new int[n/2];
	    int i=0;
	    int nf = 1;
	    while(nf<n){
	        arr[i++] = nf;
	        nf+=2;
	    }
	    nf = 2;
	    i=0;
	    while(nf<=n){
	        aaq[i++] = nf;
	        nf+=2;
	    }
	    
	    int o1 = 0;
	    int o2 =0;
	    int sd[] = new int[n/2];
	    for(int ii=0;ii<n/2;ii++){
	        sd[ii] = sc.nextInt();
	    }
	    Arrays.sort(sd);
	    for(int ii=0;ii<n/2;ii++){
	        o1+=Math.abs(arr[ii]-sd[ii]);
	    }
	    for(int ii=0;ii<n/2;ii++){
	        o2+=Math.abs(aaq[ii]-sd[ii]);
	    }
	    System.out.println(Math.min(o1,o2));
	}
}