import java.util.Scanner;

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

        int n = input.nextInt();

        boolean[] eBoard = new boolean[n];
        boolean[] oBoard = new boolean[n];

        for(int i = 0; i < n/2; i++)
        {
            int next = input.nextInt()-1;
            eBoard[next] = true;
            oBoard[next] = true;
        }

        int eCount = 0;

        for(int j = 0; j < n; j++)
        {
            int closestDistance = 1000;

            boolean closestNotFound = true;

            if((j)%2 != 0 && eBoard[j] == true)
            {
                int previous = j;

                for (int a = 0; a < n; a += 2)
                {
                    if (eBoard[a] == false && Math.abs(j - a) < closestDistance)
                    {
                        closestDistance = Math.abs(j - a);
                        eBoard[a] = true;
                        eBoard[previous] = false;

                        previous = a;
                    }
                }
                eCount += closestDistance;
            }
        }

        int oCount = 0;

        for(int k = 0; k < n; k++)
        {
            int closestDistance = 1000;

            if((k)%2 == 0 && oBoard[k] == true)
            {
                int previous = k;

                for (int a = 1; a < n; a+=2)
                {
                    if (oBoard[a] == false && Math.abs(k - a) < closestDistance)
                    {
                        closestDistance = Math.abs(k - a);
                        oBoard[a] = true;
                        oBoard[previous] = false;

                        previous = a;
                    }
                }
                oCount += closestDistance;
            }
        }

        System.out.println(Integer.min(oCount, eCount));
    }
}
