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