#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n / 2];
  for (int j = 0; j < (n / 2); j++) cin >> A[j];
  int sum1 = 0, sum2 = 0;
  for (int j = 2; j <= n; j += 2) {
    sum1 += abs(A[(j - 2) / 2] - j);
  }
  for (int k = 1; k < n; k += 2) {
    sum2 += abs(A[(k - 1) / 2] - k);
  }
  cout << min(sum1, sum2);
  return 0;
}
