import java.util.*;
public class chess{
    
    static int[] arr , arr2;
    public static void main(String[] args){
        
        Scanner s = new Scanner(System.in);
        int n = s.nextInt() ;
        arr = new int[n + 1];
        arr2 = new int[n + 1];
        
        for(int i = 0;i < n/2;i++){
            int p = s.nextInt();
            arr[p] = 1;
            arr2[p] = 1;
        }
        
        int allblack = 0 , allwhite = 0;
        for(int i = 1;i <= n;i++){
            
            if(i%2 == 0 && arr[i] != 0){
                int ele1 = front(i + 1 , 'b' , arr);
                int ele2 = back(i - 1, 'b' ,arr);
                
                if(ele1 < ele2){
                    arr[ele1] = 1;
                    allblack+=(ele1 - i);
                }
                else{
                    
                    arr[ele2] = 1;
                    allblack+=(i - ele2);
                }
                
//                 System.out.println("b = "+ele1+"  "+ele2+" indx "+i);
                
            }//if
        }//for loop
        
        for(int i = 1;i <= n;i++){
            
            if(i%2 != 0 && arr2[i] != 0){
                int ele1 = front(i + 1 , 'w' ,arr2);
                int ele2 = back(i - 1, 'w' ,arr2);
                
                if(ele1 < ele2){
                    arr2[ele1] = 1;
                    allwhite+=(ele1 - i);
                }
                else{
                    
                    arr2[ele2] = 1;
                    allwhite+=(i - ele2);
                }
                
//                 System.out.println("w = "+ele1+"  "+ele2+" indx "+i);
                
            }//if
        }//for loop
        
        System.out.println(Math.min(allblack , allwhite));
        
    }//main
    
    public static int front(int indx , char c , int[]arr){
    
        if(c == 'b'){ //for all black
            if(indx < arr.length){
                if( !(arr[indx] == 0 && indx%2 != 0) )
                    return front(indx + 1,c ,arr) ;
            }
            else 
                return 1000000;
            
        }
        
        else{ //for all white
        
            if(indx < arr.length){
                if( !(arr[indx] == 0 && indx%2 == 0) )
                 return front(indx + 1 , c ,arr);
                
            }
            else 
                return 1000000;
        }
        return indx;
        
    }
    
    public static int back(int indx , char c ,int[] arr){
        
        if(c == 'b'){
            if(indx > 0){
                if( !(arr[indx] == 0 && indx%2 != 0 ) )
                 return back(indx-1 , c ,arr );
                
                
            }
                else
                    return 1000000;
        }
        
        else{
        
            if(indx > 0){
                if( !(arr[indx] ==0 && indx%2 == 0) )
                   return back(indx - 1,c ,arr);
                
            }
            else 
                return 1000000;
            
        }
        return indx;
        
    }
    
    
}
