#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n / 2], codd = 0, ceven = 0;
  bool b[n], c[n];
  for (int i = 0; i < n / 2; i++) {
    cin >> a[i];
    b[a[i] - 1] = 1;
    c[a[i] - 1] = 1;
  }
  sort(a, a + n / 2);
  int i;
  for (i = 0; i < n / 2; i++) {
    if (a[i] % 2 == 0) {
      b[a[i] - 1] = 0;
      if (b[a[i]] == 0) {
        codd += 1;
        b[a[i]] = 1;
      } else {
        codd += 1;
        for (int j = a[i] + 2; j <= n; j += 2) {
          codd += 2;
          if (b[j] == 0) {
            b[j] = 1;
            break;
          }
        }
      }
    } else {
      c[a[i] - 1] = 0;
      if (c[a[i]] == 0) {
        ceven += 1;
        c[a[i]] = 1;
      } else {
        ceven += 1;
        for (int j = a[i] + 2; j <= n; j += 2) {
          ceven += 2;
          if (c[j] == 0) {
            c[j] = 1;
            break;
          }
        }
      }
    }
  }
  cout << min(codd, ceven);
}
