#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  int a[n / 2];
  int sum = 0;
  int x = 0;
  {
    for (int i = 0; i < n / 2; ++i) {
      int a;
      cin >> a;
      sum += abs(2 * i + 1 - a);
      x += abs(2 * i + 2 - a);
    }
  }
  if (sum < x)
    cout << sum << endl;
  else
    cout << x << endl;
  return 0;
}
