#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  cin >> n;
  int t = 1, ans = 0;
  for (int i = 1; i <= n / 2; i++) {
    cin >> a;
    ans += fabs(t - a);
    t += 2;
  }
  cout << ans;
}
