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