#include <bits/stdc++.h>
using namespace std;
long long a[1000001], b[1000001], c[1000001], n, m, l, ans1, ans2, k, x, y, z,
    d, p, o, u, t, r;
vector<int> v;
string s;
char C;
queue<int> q;
int main() {
  cin >> n;
  for (int i = 1; i <= n / 2; i++) {
    cin >> a[i];
    ans1 += abs(2 * i - a[i]);
    ans2 += abs((2 * i - 1) - a[i]);
  }
  cout << min(ans1, ans2);
  return 0;
}
