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