#include <bits/stdc++.h>
using namespace std;
int arr1, arr2, n, a[111], pos = 1;
int main() {
  cin >> n;
  for (int i = 1; i <= n / 2; i++) {
    cin >> a[i];
    arr1 += abs(a[i] - pos++);
    arr2 += abs(a[i] - pos++);
  }
  cout << min(arr1, arr2);
  return 0;
}
