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