import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ProbA
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);

        int boardL = input.nextInt();

        boolean moreOnWhite = true;

        List<Integer> initPos = new ArrayList<Integer>();

        int toMoveBlack = 0;

        int toMoveWhite = 0;

        int numBlack = 0;

        int numWhite = 0;

        for(int i = 0; i < boardL/2; i++)
        {
            int next = input.nextInt();

            initPos.add(next);

            if(next%2 == 0)
            {
                numWhite++;
            }
            else
            {
                numBlack++;
            }
        }

        if(numWhite == 0 || numBlack == 0)
        {
            System.out.println(0);
            return;
        }

            for(int i = 0; i < boardL/2; i++)
            {
                if(initPos.get(i)%2 == 0)//if its white
                {
                    int toGoL = Integer.MAX_VALUE;

                    int toGoR = Integer.MAX_VALUE;

                    for(int j = initPos.get(i)-1; j > 0; j-=2)//left
                    {
                        if(!initPos.contains(new Integer(j)))
                        {
                            toGoL = initPos.get(i)-j;
                            initPos.add(j);
                            break;
                        }
                    }
                    for(int k = initPos.get(i)+1; k < boardL+1; k+=2)
                    {
                        if(!initPos.contains(new Integer(k)))//fill in new spots
                        {
                            toGoR = k-initPos.get(i);
                            initPos.add(k);
                            break;
                        }
                    }

                    toMoveWhite += Math.min(toGoL, toGoR);
                }
            }

            for(int i = 0; i < boardL/2; i++)
            {
                if(initPos.get(i)%2 != 0)
                {
                    int toGoL = Integer.MAX_VALUE;

                    int toGoR = Integer.MAX_VALUE;

                    for(int j = initPos.get(i)-1; j > 0; j-=2)//left
                    {
                        if(!initPos.contains(new Integer(j)))
                        {
                            toGoL = initPos.get(i)-j;
                            initPos.add(j);
                            break;
                        }
                    }
                    for(int k = initPos.get(i)+1; k < boardL+1; k+=2)
                    {
                        if(!initPos.contains(new Integer(k)))
                        {
                            toGoR = k-initPos.get(i);
                            initPos.add(k);
                            break;
                        }
                    }

                    toMoveBlack += Math.min(toGoL, toGoR);
                }
            }

        System.out.println(Math.min(toMoveBlack,toMoveWhite));
    }
}
