#include <bits/stdc++.h>
int main() {
  int n, d, i, t, x, y, sum;
  d = 1;
  sum = 0;
  x = 2;
  y = 0;
  int a[10000];
  scanf("%d", &n);
  for (i = 0; i < n / 2; i++) {
    scanf("%d", &a[i]);
    t = a[i] - d;
    if (t < 0) {
      t = -t;
    }
    sum += t;
    d += 2;
  }
  for (i = 0; i < n / 2; i++) {
    t = a[i] - x;
    if (t < 0) {
      t = -t;
    }
    y += t;
    x += 2;
  }
  if (sum < y) {
    printf("%d\n", sum);
  } else
    printf("%d\n", y);
  return 0;
}
