#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> b, w;
  long long int p[n];
  for (long long int i = 0; i < n / 2; i++) cin >> p[i];
  long long int m1 = 0, m = 0;
  for (long long int i = 1; i <= n; i++) {
    if (i % 2 == 1)
      b.push_back(i);
    else
      w.push_back(i);
  }
  for (long long int i = 0; i < n / 2; i++) m = m + abs(b[i] - p[i]);
  for (long long int i = 0; i < n / 2; i++) m1 = m1 + abs(w[i] - p[i]);
  long long int ans = min(m, m1);
  cout << ans << endl;
  return 0;
}
