#include <bits/stdc++.h>
inline long long int no_of_digits(long long int n) {
  return 1 + floor(log10(n));
}
using namespace std;
int main() {
  long long int i, j, k, m, n, q, t, count1 = -1, count2 = -1, temp1, temp2;
  cin >> n;
  long long int o[n], e[n], a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 0) {
      e[++count1] = a[i];
    } else {
      o[++count2] = a[i];
    }
  }
  if (count1 == count2 or (abs(count1 - count2) == 1))
    cout << 0;
  else if (count1 > count2) {
    sort(e, e + count1);
    cout << e[0];
  } else {
    sort(o, o + count2);
    cout << o[0];
  }
  return 0;
}
