#include <bits/stdc++.h>
using namespace std;
const int limN = 103;
int N, Ai, Bp, Wp, Bc, Wc;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  Bp = 1;
  Wp = 2;
  for (int i = 0; i < N / 2; i++, Bp += 2, Wp += 2) {
    cin >> Ai;
    Bc += abs(Bp - Ai);
    Wc += abs(Wp - Ai);
  }
  cout << min(Bc, Wc);
  return 0;
}
