#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7, M = 2e5 + 7, LG = 30, inf = 1e8 + 7;
int a[N], b[N];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n / 2; i++) {
    cin >> a[i];
  }
  int mn = INT_MAX, sum = 0;
  for (int i = 1, j = 1; i <= n; i += 2, j++) {
    sum += abs(i - a[j]);
  }
  mn = min(mn, sum);
  sum = 0;
  for (int i = 2, j = 1; i <= n; i += 2, j++) {
    sum += abs(i - a[j]);
  }
  mn = min(mn, sum);
  cout << mn << endl;
}
