#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long long a[211111];
  bool left = true;
  bool right = true;
  cin >> n;
  long long cnt = 0;
  for (int i = 1; i <= n / 2; i++) cin >> a[i];
  for (int i = n; i >= 2; i -= 2) {
    cnt += i - a[i / 2];
  }
  long long cnt1 = 0;
  for (int i = n - 1; i >= 1; i -= 2) {
    cnt1 += abs(i - a[i / 2]);
  }
  long long ans = min(cnt, cnt1);
  cout << ans << endl;
  return 0;
}
