#include <bits/stdc++.h>
using namespace std;
int n, x, ans1 = 0, ans2 = 0;
int main() {
  cin >> n;
  for (int i = 1; i * 2 <= n; i++) {
    cin >> x;
    ans1 += abs(x - (i * 2 - 1));
    ans2 += abs(x - i * 2);
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}
