#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  int n;
  cin >> n;
  int odd = 0, even = 0;
  for (int i = 0; i < (n / 2); ++i) {
    int a;
    cin >> a;
    odd += abs(2 * i + 1 - a);
    even += abs(2 * i + 2 - a);
  }
  int ans = min(odd, even);
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
