#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c < '0' || c > '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
const int INF = 2e9;
const int MX = 100005;
const int MOD = 1000000007;
const double PI = acos(-1.0);
int main() {
  int n = ({
    int a;
    read(a);
    a;
  });
  int a[n / 2 + 5];
  for (int i = 1; i <= n / 2; i++) {
    a[i] = ({
      int a;
      read(a);
      a;
    });
  }
  int b = 0, w = 0;
  int cnt = 1;
  for (int i = 1; i <= n / 2; i++) {
    b += abs(a[i] - cnt);
    cnt += 2;
  }
  cnt = 2;
  for (int i = 1; i <= n / 2; i++) {
    w += abs(a[i] - cnt);
    cnt += 2;
  }
  printf("%d\n", min(b, w));
  return 0;
}
