#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, even = 0, odd = 0, j = 0, z = 0;
  scanf("%d", &n);
  int a[n], x[n], y[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 2 == 0)
      even++;
    else
      odd++;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i] % 2 == 0) {
      x[j] = a[i];
      j++;
    } else {
      y[z] = a[i];
      z++;
    }
  }
  if (even == 0)
    printf("%d\n", y[z - 1]);
  else if (odd == 0)
    printf("%d\n", x[j - 1]);
  else if (j > z + 1) {
    printf("%d\n", x[j - 1]);
  } else if (j + 1 < z) {
    printf("%d\n", y[z - 132]);
  } else if (z == j + 1 || j == z + 1 || j == z)
    printf("0\n");
  return 0;
}
