#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k = 1, cnt = 0, cnt1 = 0, q = 2;
  cin >> n;
  int ar[n + 5];
  for (i = 0; i < n / 2; i++) {
    cin >> ar[i];
    cnt += abs(k - ar[i]);
    k += 2;
  }
  for (i = 0; i < n / 2; i++) {
    cnt1 += abs(q - ar[i]);
    q += 2;
  }
  cout << min(cnt, cnt1) << endl;
  return 0;
}
