/* 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) 
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int len=n/2;
		int array[]=new int[len];
		for(int i=0;i<len;i++){
			array[i]=sc.nextInt();
		}
		
		int sum1=0;int odd=1;
		for(int i=0;i<array.length;i++){
			sum1=sum1+Math.abs(array[i]-odd);
			odd+=2;
		}
		
		int sum2=0;int even=2;
		for(int i=0;i<array.length;i++){
			sum2=sum2+Math.abs(array[i]-even);
			even+=2;
		}
		
		if(sum2<sum1){System.out.println(sum2);}
		else{System.out.println(sum1);}
	}
}
