#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, dd, x = 0, y = 0, num[110], min, min1 = 0, min2 = 0, s1[110] = {0},
             s2[110] = {0};
  scanf("%d", &n);
  for (int i = 1; i <= n / 2; i++) {
    scanf("%d", &num[i]);
    s1[num[i]] = 1;
    s2[num[i]] = 1;
    if (num[i] % 2 == 0) {
      x++;
    } else {
      y++;
    }
  }
  dd = n / 2;
  sort(num, num + dd);
  if (x == y || x == 0 || y == 0) {
    printf("0\n");
  } else {
    for (int i = 1; i <= n / 2; i++) {
      dd = num[i];
      if (dd % 2 != 0) {
        int mina = 999, mind = 999;
        for (int j = dd + 1; j <= n; j += 2) {
          if (s1[j] != 1) {
            mina = j - dd;
            s1[j] = 1;
            break;
          }
        }
        for (int j = dd - 1; j > 0; j -= 2) {
          if (s1[j] != 1) {
            mind = dd - j;
            s1[j] = j;
            break;
          }
        }
        min1 += mina < mind ? mina : mind;
      }
    }
    for (int i = 1; i <= n / 2; i++) {
      dd = num[i];
      if (dd % 2 == 0) {
        int mina = 999, mind = 999;
        for (int j = dd + 1; j <= n; j += 2) {
          if (s2[j] != 1) {
            mina = j - dd;
            s2[j] = 1;
            break;
          }
        }
        for (int j = dd - 1; j > 0; j -= 2) {
          if (s2[j] != 1) {
            mind = dd - j;
            s2[j] = 1;
            break;
          }
        }
        min2 += mina < mind ? mina : mind;
      }
    }
    min = min1 < min2 ? min1 : min2;
    printf("%d\n", min);
  }
  return 0;
}
