#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p[105] = {0};
  cin >> n;
  for (int i = 1; i <= n / 2; i++) cin >> p[i];
  int c = 0, pd;
  if (p[1] == 1)
    pd = n - 1;
  else
    pd = n;
  for (int i = n / 2; i > 0; i--) {
    c += abs(pd - p[i]);
    pd = pd - 2;
  }
  cout << c << endl;
  return 0;
}
