#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int o = 0, e = 0;
  for (int i = 0; i < n / 2; i++) {
    int a;
    cin >> a;
    o += abs(2 * i + 1 - a);
    e += abs(2 * i + 2 - a);
  }
  cout << min(o, e) << endl;
}
