import java.util.*;

public class Program {


	public static void main(String[] args) {
		/*
		 * Enter your code here. Read input from STDIN. Print output to STDOUT.
		 * Your class should be named Solution.
		 */
		Scanner s=new Scanner(System.in);
         int n=s.nextInt();
         boolean arr1[]=new boolean[n];
         boolean arr2[]=new boolean[n];
         Arrays.fill(arr1, false);
         Arrays.fill(arr2, false);
         for(int i=0;i<n/2;i++)
         {
        	 int a=s.nextInt()-1;
        	 arr1[a]=true;
        	 arr2[a]=true;
         }
         int moves=0,tempb=0,tempw=0;
        for(int i=0;i<n;i=i+2)
        {
        	int temp1=1,temp2=1;
        	if(arr1[i])
        	{
        		
        		int j=i+1;
        		while(j<n&&arr1[j])
        		{
        			temp1=temp1+2;
        			j=j+2;
        		}
        		if(j>n-1)
        			temp1=Integer.MAX_VALUE;
        		
        		int k=i-1;
        		while(k>-1&&arr1[k])
        		{
        			temp2=temp2+2;
        			k=k-2;
        		}
        		
        		if(k<0)
        			temp2=Integer.MAX_VALUE;
        		
        		tempw=tempw+Math.min(temp1, temp2);
        		int b=Math.min(temp1, temp2);
        		
        		if(b==temp1)
        		{
        			arr1[i]=false;
        			arr1[j]=true;
        		}
        		else
        		{
        			arr1[i]=false;
        			arr1[k]=true;
        		}
        	}
        }
        	for(int i=1;i<n;i=i+2)
            {
            	int temp1=1,temp2=1;
            	if(arr2[i])
            	{
            		
            		int j=i+1;
            		while(j<n&&arr2[j])
            		{
            			temp1=temp1+2;
            			j=j+2;
            		}
            		
            		if(j>n-1)
            			temp1=Integer.MAX_VALUE;
            		
            		int k=i-1;
            		while(k>-1&&arr2[k])
            		{
            			temp2=temp2+2;
            			k=k-2;
            		}
            		
            		if(k<0)
            			temp2=Integer.MAX_VALUE;
            		
            		tempb=tempb+Math.min(temp1, temp2);
            		int b=Math.min(temp1, temp2);
            		if(b==temp1)
            		{
            			arr2[i]=false;
            			arr2[j]=true;
            		}
            		else
            		{
            			arr2[i]=false;
            			arr2[k]=true;
            		}
            	}
        	
        
         
		

	}
        	moves=Math.min(tempb, tempw);
        	System.out.println(moves);
 }
}