#include <bits/stdc++.h>
using namespace std;
int n, p[55];
int main() {
  cin >> n;
  n /= 2;
  for (int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < n; i++) ans += abs(p[i] - (2 * i + 2));
  if (ans == 0) ans = 1e9;
  int ans2 = 0;
  for (int i = 0; i < n; i++) ans2 += abs(p[i] - (2 * i + 1));
  if (ans2 == 0) ans2 = 1e9;
  cout << min(ans, ans2) << '\n';
  return 0;
}
