#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n / 2);
  for (auto &x : a) cin >> x;
  long long d1 = 0, d2 = 0;
  for (long long i = (0); i < (long long)(n / 2); i++) {
    d1 += abs(2 * i - (a[i] - 1));
  }
  for (long long i = (0); i < (long long)(n / 2); i++) {
    d2 += abs((2 * i + 1) - (a[i] - 1));
  }
  long long resp = min(d1, d2);
  printf("%lld\n", resp);
}
