#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int data[1000];
  int aa[10000] = {0};
  int bb[10000] = {0};
  for (int i = 0; i < n / 2; i++) {
    scanf("%d", &data[i]);
    aa[data[i]]++;
    bb[data[i]]++;
  }
  int sum1 = 0;
  int sum2 = 0;
  for (int i = 0; i < n / 2; i++) {
    if (data[i] % 2 == 0) {
      int g = 0;
      for (int j = data[i] + 1; j <= n; j++) {
        if (aa[j] == 0 && j % 2 == 1) {
          sum1 = sum1 + j - data[i];
          aa[j]++;
          g = 1;
          break;
        }
      }
      if (g == 0) {
        for (int j = data[i] - 1; j >= 1; j--) {
          if (aa[j] == 0 && j % 2 == 1) {
            sum1 = sum1 - j + data[i];
            aa[j]++;
            break;
          }
        }
      }
    }
  }
  for (int i = 0; i < n / 2; i++) {
    if (data[i] % 2 == 1) {
      int g = 0;
      for (int j = data[i] + 1; j <= n; j++) {
        if (bb[j] == 0 && j % 2 == 0) {
          sum2 = sum2 + j - data[i];
          bb[j]++;
          g = 1;
          break;
        }
      }
      if (g == 0) {
        for (int j = data[i] - 1; j >= 1; j--) {
          if (bb[j] == 0 && j % 2 == 0) {
            sum2 = sum2 - j + data[i];
            bb[j]++;
            break;
          }
        }
      }
    }
  }
  if (sum1 < sum2) {
    printf("%d", sum1);
  } else {
    printf("%d", sum2);
  }
}
