#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int gore, dole;
} dom;
dom domina[105];
int n;
long s_g, s_d, n_g, n_d;
bool par_nepar = false;
int main(int argc, char** argv) {
  scanf("%i", &n);
  for (int i = 0; i < n; i++) {
    scanf("%i %i", &domina[i].gore, &domina[i].dole);
    s_g += domina[i].gore;
    s_d += domina[i].dole;
    if (!par_nepar) {
      par_nepar = (domina[i].gore % 2 == 1) * (domina[i].dole % 2 == 0) +
                  (domina[i].gore % 2 == 0) * (domina[i].dole % 2 == 1);
    }
    n_g += (domina[i].gore % 2 == 1);
    n_d += (domina[i].dole % 2 == 1);
  }
  if (s_g % 2 == 0 && s_d % 2 == 0) {
    printf("0");
    return 0;
  }
  if (n == 1) {
    printf("-1");
    return 0;
  }
  if (par_nepar && n_g % 2 == 1 && n_d % 2 == 1) {
    printf("1");
    return 0;
  }
  printf("-1");
  return 0;
}
