#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<bool> p(n);
  for (int i = 0; i < n / 2; ++i) {
    int aux;
    cin >> aux;
    p[aux - 1] = true;
  }
  int movements = 0;
  int i_r = 0;
  for (int i = 0; i < n; ++i) {
    if (p[i]) {
      movements += abs(i - i_r);
      i_r += 2;
    }
  }
  cout << movements << endl;
}
