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