#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int pos[110];
int n;
int dfs(int x, int now) {
  if (x >= n / 2) return 0;
  if (now > n) return inf;
  int ret = inf;
  int has = n / 2 - x - 1;
  for (int i = now; i + has * 2 <= n; i += 2)
    ret = min(dfs(x + 1, i + 2) + abs(pos[x] - i), ret);
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n / 2; i++) scanf("%d", &pos[i]);
  sort(pos, pos + n / 2);
  int l = 0, r = n / 2 - 1;
  printf("%d\n", min(dfs(0, 1), dfs(0, 2)));
  return 0;
}
