import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.*;

public class Main {

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;

        return gcd(b%a, a);
    }


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

        int n = in.nextInt();

        int board[] = new int[n+1];
        for(int i = 0; i < n/2; i++) {
            int p = in.nextInt();
            board[p] = 1;
        }

        int result = Integer.MAX_VALUE;

        int moves = 0;
        int lastPosition = 1;
        for(int i = 1; i <= n; i++) {
            if(board[i] == 1) {
                int d = Math.abs(i-lastPosition);
                moves += d;
                lastPosition += 2;
            }
        }

        if(moves < result) {
            result = moves;
        }

        moves = 0;
        lastPosition = 2;
        for(int i = 1; i <= n; i++) {
            if(board[i] == 1) {
                int d = Math.abs(i-lastPosition);
                moves += d;
                lastPosition += 2;
            }
        }

        if(moves < result) {
            result = moves;
        }

        System.out.println(result);

        in.close();
    }

}