#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long f = n / 2;
  long long a[f];
  for (long long i = 0; i < f; i++) cin >> a[i];
  long long odd = 0, even = 0;
  for (long long i = 0; i < f; i++) {
    odd += abs(a[i] - (i * 2 + 1));
    even += abs(a[i] - (i * 2 + 2));
  }
  long long ans = min(odd, even);
  cout << ans << endl;
  return 0;
}
