#include <bits/stdc++.h>
int main() {
  int n, odd = 0, even = 0;
  int temp;
  scanf("%d", &n);
  for (int i = 1; i <= n / 2; i++) {
    scanf("%d", &temp);
    odd += abs(2 * i - 1 - temp);
    even += abs(2 * i - temp);
  }
  if (odd > even)
    printf("%d", even);
  else
    printf("%d", odd);
  return 0;
}
