/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Minesweeper
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int array[]=new int[n/2];
		for(int i=0;i<n/2;i++){
		    array[i]=sc.nextInt();
		}
		int sum=0;int odd=1;int even=2;
		if(array[0]%2==1){
		    for(int i=0;i<n/2;i++){
		        sum=sum+Math.abs(odd-array[i]);
		        
		        odd+=2;
		    }
		}
		else{
		    for(int i=0;i<n/2;i++){
		        sum=sum+Math.abs(even-array[i]);
		        even=even+2;
		    }
		}
		System.out.println(sum);
	}
}
