/* 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 Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		int i,j,k,t=1,n,x,f;
		Scanner sc=new Scanner(System.in);
	//	t=sc.nextInt();
		while(t-->0){
		    n=sc.nextInt();
		    k=n/2;
		    j=1;
		    int an=0;
		    for(i=0;i<k;i++){
		        x=sc.nextInt();
		        an+=Math.abs(x-j);
		        j+=2;
		    }
		    System.out.println(an);
		    
		}
		
	}
}
