#include <bits/stdc++.h>
using namespace std;
int Abs(int a) { return max(a, -a); }
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int min_free_w = 1, min_free_b = 0, answer_w = 0, answer_b = 0;
  for (int i = 0; i < n / 2; i++) {
    int a;
    cin >> a;
    a--;
    answer_w += Abs(a - min_free_w);
    answer_b += Abs(a - min_free_b);
    min_free_w += 2;
    min_free_b += 2;
  }
  cout << min(answer_w, answer_b) << endl;
}
