#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> pos(n / 2);
  for (int i = 0; i < n / 2; i++) {
    cin >> pos[i];
  }
  long long int even = 0;
  long long int odd = 0;
  for (int i = 0; i < n / 2; i++) {
    if (pos[i] >= (2 * i + 2))
      even += pos[i] - (2 * i + 2);
    else
      even += 2 * i + 2 - pos[i];
  }
  for (int i = 0; i < n / 2; i++) {
    if (pos[i] >= 2 * i + 1)
      odd += pos[i] - (2 * i + 1);
    else
      odd += 2 * i + 1 - pos[i];
  }
  long long int ans;
  if (odd > even) {
    ans = even;
  } else {
    ans = odd;
  }
  cout << ans << endl;
  return 0;
}
