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