#include <bits/stdc++.h>
using namespace std;
long long int input[50000];
long long int even[50000];
long long int odd[50000];
long long int min(long long int a, long long int b) {
  if (a > b)
    return b;
  else
    return a;
}
int main() {
  long long int i, j, k, l, m, n, p, ans1 = 0, ans2 = 0;
  scanf("%lld", &n);
  for (i = 1; i <= n / 2; i++) scanf("%lld", &input[i]);
  j = 1;
  for (i = 1; i <= n / 2; i++) {
    odd[i] = j;
    j += 2;
  }
  j = 2;
  for (i = 1; i <= n / 2; i++) {
    even[i] = j;
    j += 2;
  }
  for (i = 1; i <= n; i++) {
    ans1 += abs(odd[i] - input[i]);
  }
  for (i = 1; i <= n; i++) {
    ans2 += abs(even[i] - input[i]);
  }
  printf("%lld\n", min(ans2, ans1));
}
