//package info.stochastic;
import java.io.*;
import java.util.*;

public class A {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {

        void swap(int[] arr, int i, int j) {
            int tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] boardW = new int[n];
            int[] boardB = new int[n];
            for (int i = 0; i < n / 2; i++) {
                int a = in.nextInt();
                boardW[a - 1] = 1;
                boardB[a - 1] = 1;
            }

            int ansB = 0;
            for (int i = 0; i < n; i++) {
                // set piece there
                if (i % 2 == 0 && boardB[i] == 0) {
                    for (int j = i + 1; j < n; j++) {
                        ansB++;
                        if (boardB[j] == 1) {
                            swap(boardB, i, j);
                            break;
                        }
                    }
                } else if (i % 2 != 0 && boardB[i] != 0) {
                    for (int j = i + 1; j < n; j++) {
                        ansB++;
                        if (boardB[j] == 0) {
                            swap(boardB, i, j);
                            break;
                        }
                    }
                }
            }

            int ansW = 0;
            for (int i = 0; i < n; i++) {
                // set piece there
                if (i % 2 != 0 && boardW[i] == 0) {
                    for (int j = i + 1; j < n; j++) {
                        ansW++;
                        if (boardW[j] == 1) {
                            swap(boardW, i, j);
                            break;
                        }
                    }
                } else if (i % 2 == 0 && boardW[i] != 0) {
                    for (int j = i + 1; j < n; j++) {
                        ansW++;
                        if (boardW[j] == 0) {
                            swap(boardW, i, j);
                            break;
                        }
                    }
                }
            }

            out.print(Math.min(ansB, ansW));
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}
