#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool a[n + 1], b[n + 1], c[n + 1];
  memset(a, 0, sizeof a);
  memset(b, 0, sizeof b);
  memset(c, 0, sizeof c);
  for (int i = 0; i < n / 2; i++) {
    int x;
    cin >> x;
    a[x] = 1;
    b[x] = 1;
    c[x] = 1;
  }
  int bc = 0, bbb = 0, cc = 0, ccc = 0;
  for (int i = 1; i <= n; i += 2) {
    bool flag = 1;
    if (a[i] == 1) {
      bc++;
      for (int j = i + 1; j <= n; j += 2) {
        if (b[j] == 0) {
          flag = 0;
          b[j] = 1;
          break;
        }
        bc += 2;
      }
      if (flag) {
        bc = 1;
        for (int j = i - 1; j > 0; j -= 2) {
          if (c[j] == 0) {
            flag = 0;
            c[j] = 1;
            break;
          }
          bc += 2;
        }
        bbb += bc;
        bc = 100000;
        bc = 0;
        break;
      }
      bbb += bc;
      bc = 0;
    }
    bbb += bc;
    bc = 0;
  }
  for (int i = 2; i <= n; i += 2) {
    bool flag = 1;
    if (a[i] == 1) {
      cc++;
      for (int j = i + 1; j <= n; j += 2) {
        if (c[j] == 0) {
          flag = 0;
          c[j] = 1;
          break;
        }
        cc += 2;
      }
      if (flag) {
        cc = 1;
        for (int j = i - 1; j > 0; j -= 2) {
          if (c[j] == 0) {
            flag = 0;
            c[j] = 1;
            break;
          }
          cc += 2;
        }
        ccc += cc;
        cc = 100000;
        cc = 0;
        break;
      }
      ccc += cc;
      cc = 0;
    }
    ccc += cc;
    cc = 0;
  }
  cout << min(bbb, ccc);
}
