#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool arr[n + 1], brr[n + 1];
  for (int i = 0; i < n + 1; i++) {
    arr[i] = 0;
    brr[n + 1] = 0;
  }
  for (int i = 1; i <= (n + 1) / 2; i++) {
    int a;
    cin >> a;
    arr[a] = 1;
    brr[a] = 1;
  }
  int count_oddset = 0;
  int count_evenset = 0;
  if (n == 2) {
    cout << "0" << endl;
  } else {
    for (int i = 2; i < n + 1; i += 2) {
      for (int j = 1; j < n + 1; j += 2) {
        if (arr[i] == 1) {
          if (arr[j] == 0) {
            count_oddset += abs(j - i);
            arr[j] = 1;
            arr[i] = 0;
            break;
          }
        }
      }
    }
    for (int i = 1; i < n + 1; i += 2) {
      for (int j = 2; j < n + 1; j += 2) {
        if (brr[i] == 1) {
          if (brr[j] == 0) {
            count_evenset += abs(j - i);
            brr[j] = 1;
            brr[i] = 0;
            break;
          }
        }
      }
    }
    cout << min(count_oddset, count_evenset) << endl;
  }
}
