#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int a, sum1, sum2;
int main() {
  int n;
  cin >> n;
  v.push_back(0);
  for (int i = 0; i < n / 2; i++) {
    cin >> a;
    v.push_back(a);
  }
  for (int i = 1; i <= n / 2; i++) {
    sum1 += abs((2 * i - 1) - v[i]);
  }
  for (int i = 1; i <= n / 2; i++) {
    sum2 += abs((2 * i) - v[i]);
  }
  cout << min(sum1, sum2) << endl;
}
