#include <bits/stdc++.h>
using namespace std;
int n;
int pieza[1235678];
int main() {
  cin >> n;
  for (int i = 0; i < n / 2; ++i) {
    cin >> pieza[i];
  }
  int minn = 1000000007;
  for (int i = 0; i < 2; ++i) {
    int posi = n - i;
    int tot = 0;
    for (int a = 0; a < n / 2; a++) {
      tot += abs(posi - pieza[n / 2 - 1 - a]);
      posi -= 2;
    }
    minn = min(tot, minn);
  }
  cout << minn << endl;
}
