#include <bits/stdc++.h>
using namespace std;
int diff(vector<int> a, vector<int> b, int n) {
  int i, ans = 0;
  for (i = 0; i < n; i++) ans += abs(a[i] - b[i]);
  return ans;
}
int main() {
  int n, i;
  cin >> n;
  n = n / 2;
  vector<int> vec(n), a(n), b(n);
  for (i = 0; i < n; i++) {
    a[i] = 2 * i + 2;
    b[i] = 2 * i + 1;
  }
  for (i = 0; i < n; i++) {
    cin >> vec[i];
  }
  cout << min(diff(a, vec, n), diff(b, vec, n));
  return 0;
}
