#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> p;
  for (int i = 0; i < n / 2; i++) {
    int tmp;
    cin >> tmp;
    p.push_back(tmp);
  }
  reverse(p.begin(), p.end());
  int a = 0, b = 0;
  int ee = n - 1;
  for (int i = 0; i < n / 2; i++) {
    a += abs(ee - p[i]);
    ee -= 2;
  }
  ee = n;
  for (int i = 0; i < n / 2; i++) {
    b += abs(ee - p[i]);
    ee -= 2;
  }
  cout << min(a, b) << endl;
  return 0;
}
