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