#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 bb = 0, cc = 0;
  for (int i = 1; i <= n; i += 2) {
    for (int j = i + 1; j <= n; j += 2) {
      if (b[j] == 0) {
        b[i] = 0;
        b[j] = 1;
        bb += abs(i - j);
        break;
      }
    }
    for (int j = i - 1; j > 0; j -= 2) {
      if (b[j] == 0) {
        b[i] = 0;
        b[j] = 1;
        bb += abs(i - j);
        break;
      }
    }
  }
  for (int i = 2; i <= n; i += 2) {
    for (int j = i + 1; j <= n; j += 2) {
      if (c[j] == 0) {
        c[i] = 0;
        c[j] = 1;
        cc += abs(i - j);
        break;
      }
    }
    for (int j = i - 1; j > 0; j -= 2) {
      if (c[j] == 0) {
        c[i] = 0;
        c[j] = 1;
        cc += abs(i - j);
        break;
      }
    }
  }
  cout << min(bb, cc) << endl;
}
