#include <bits/stdc++.h>
using namespace std;
int N, a;
vector<int> poz;
int parz() {
  int suma1 = 0, suma2 = 0;
  for (int i = 0; i < poz.size(); i++) suma1 += (abs(2 * i + 2 - poz[i]));
  for (int i = 0; i < poz.size(); i++) suma2 += (abs(2 * i + 1 - poz[i]));
  return min(suma1, suma2);
}
int main() {
  cin >> N;
  for (int i = 0; i < N / 2; i++) cin >> a, poz.push_back(a);
  cout << parz();
  return 0;
}
