#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long arr[n / 2];
  for (long long i = 0; i < n / 2; i++) cin >> arr[i];
  ;
  long long t1 = 0;
  long long c = 2;
  long long t2 = 0;
  for (long long i = 0; i <= n / 2 - 1; i++) {
    t1 += abs(c - arr[i]);
    c += 2;
  }
  c = 1;
  for (long long i = 0; i <= n / 2 - 1; i++) {
    t2 += abs(c - arr[i]);
    c += 2;
  }
  cout << min(t1, t2);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) solve();
}
