#include <bits/stdc++.h>
using namespace std;
int n, p[105];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = (1); i <= (n / 2); ++i) cin >> p[i];
  int ans = 2e9, sum = 0;
  int id = 1;
  for (int i = (1); i <= (n / 2); ++i) {
    sum += abs(p[i] - id);
    id += 2;
  }
  ans = min(ans, sum);
  id = 2;
  sum = 0;
  for (int i = (1); i <= (n / 2); ++i) {
    sum += abs(p[i] - id);
    id += 2;
  }
  cout << min(ans, sum);
  return 0;
}
