#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
bool coll(pair<long long, long long> p1, pair<long long, long long> p2,
          pair<long long, long long> p3) {
  if ((p3.second - p2.second) * (p2.first - p1.first) ==
      (p2.second - p1.second) * (p3.first - p2.first))
    return true;
  else
    return false;
}
void pv(vector<long long> v) {
  for (long long i = 0; i < (long long)v.size(); i++) cout << v[i] << " ";
  cout << '\n';
}
void in(vector<long long> &v, long long n) {
  v.resize(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
}
void sortv(vector<long long> &v) { sort(v.begin(), v.end()); }
int main() {
  long long n;
  cin >> n;
  long long a[n / 2];
  long long ans = 0;
  for (long long i = 0; i < n / 2; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= n; i += 2) {
    ans += abs(a[i / 2] - i);
  }
  long long tmp = 0;
  for (long long i = 2; i <= n; i += 2) {
    tmp += abs(a[(i / 2) - 1] - i);
  }
  cout << min(ans, tmp) << '\n';
}
