#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n >> 1);
  for (int& ai : a) cin >> ai;
  int r = 0, s = 0;
  for (int i = 0; i < n >> 1; ++i) {
    r += abs(a[i] - 2 * i - 1);
    s += abs(a[i] - 2 * i - 2);
  }
  cout << min(r, s) << endl;
  return 0;
}
