#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[400];
  for (int i = 0; i < n / 2; i++) {
    cin >> a[i];
  }
  int ec = 0, qc = 0;
  int q = 1;
  int e = 2;
  for (int i = 0; i < n / 2; i++) {
    qc += abs(a[i] - q);
    q += 2;
  }
  for (int i = 0; i < n / 2; i++) {
    ec += abs(a[i] - e);
    e += 2;
  }
  cout << min(ec, qc) << endl;
  return 0;
}
