#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100], b[150];
  long i, n, sum1, sum2, m, sum3, sum4;
  scanf("%ld", &n);
  for (i = 0; i < n / 2; i++) {
    scanf("%d", &b[i]);
  }
  for (i = 0, m = 1, sum1 = 0; i < n / 2; i++, m = m + 2) {
    sum1 = abs(m - b[i]) + sum1;
    sum3 = sum1;
  }
  for (i = 0, m = 2, sum2 = 0; i < n / 2; i++, m = m + 2) {
    sum2 = abs(m - b[i]) + sum2;
    sum4 = sum2;
  }
  if (sum3 > sum4)
    cout << sum4;
  else
    cout << sum3;
}
