#include <bits/stdc++.h>
using namespace std;
int tc;
int main(void) {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long int n;
  cin >> n;
  long long int a[n / 2];
  vector<long long int> o, e;
  long long int cnto = 0, cnte = 0;
  for (long long int i = 0; i < n / 2; i++) {
    cin >> a[i];
    a[i]--;
  }
  for (long long int i = 0; i < n; i++) {
    if (i % 2 == 0)
      e.push_back(i);
    else {
      o.push_back(i);
    }
  }
  for (long long int i = 0; i < n / 2; i++) {
    cnto += (abs(a[i] - o[i]));
  }
  for (long long int i = 0; i < n / 2; i++) {
    cnte += (abs(a[i] - e[i]));
  }
  cout << min(cnto, cnte);
}
