#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 0; i < n / 2; i++) cin >> a[i];
  int white = 0, black = 0;
  for (int i = 1, j = 0; i < n; i += 2, j++) black += abs(a[j] - i);
  for (int i = 2, j = 0; i < n; i += 2, j++) white += abs(a[j] - i);
  cout << min(white, black) << endl;
  return 0;
}
