#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long x, long long p, long long MOD) {
  if (p == 0) return 1 % MOD;
  if (p == 1) return x % MOD;
  long long res = power(x, p / 2, MOD);
  res = (long long)res * res % MOD;
  if (p & 1) res = (long long)res * x % MOD;
  return res;
}
int32_t main() {
  long long n;
  cin >> n;
  n /= 2;
  long long ans[2] = {0};
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    x--;
    ans[0] += abs(x - 2 * i);
    ans[1] += abs(x - (2 * i + 1));
  }
  cout << min(ans[0], ans[1]) << endl;
}
