#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int a[55];
    for (int i = 1; i <= n / 2; i++) {
      scanf("%d", &a[i]);
    }
    int x = 1, p = 0, q = 0, z;
    for (int i = 1; i <= n; i += 2) {
      z = a[x] - i;
      p += fabs(z);
      x++;
    }
    x = 1;
    for (int i = 2; i <= n; i += 2) {
      z = a[x] - i;
      q += fabs(z);
      x++;
    }
    if (p >= q)
      cout << q << endl;
    else
      cout << p << endl;
  }
  return 0;
}
