#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int n;
  cin >> n;
  n /= 2;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int an1 = 0, an2 = 0;
  int pos1 = 1, pos2 = 2;
  for (int i = 0; i < n; i++) {
    an1 += abs(a[i] - pos1);
    an2 += abs(a[i] - pos2);
    pos2 += 2;
    pos1 += 2;
  }
  cout << min(an1, an2);
  return 0;
}
