#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, num;
  int upper, lower;
  int UPpar = 0, UPimpar = 0, LOpar = 0, LOimpar = 0;
  int PP = 0, IP = 0, II = 0, PI = 0;
  scanf("%d", &num);
  for (i = 0; i < num; i++) {
    scanf("%d %d", &upper, &lower);
    if (upper % 2 == 0)
      UPpar++;
    else
      UPimpar++;
    if (lower % 2 == 0)
      LOpar++;
    else
      LOimpar++;
    if (upper % 2 == 0 && lower % 2 == 0) PP++;
    if (upper % 2 == 0 && lower % 2 != 0) PI++;
    if (upper % 2 != 0 && lower % 2 == 0) IP++;
    if (upper % 2 != 0 && lower % 2 != 0) II++;
  }
  if (UPimpar % 2 == 0 && LOimpar % 2 == 0)
    printf("0");
  else {
    if ((UPimpar - 1) % 2 == 0 && (LOimpar + 1) % 2 == 0 && IP > 0)
      printf("1");
    else {
      if ((UPimpar + 1) % 2 == 0 && (LOimpar - 1) % 2 == 0 && PI > 0)
        printf("1");
      else
        printf("-1");
    }
  }
  return 0;
}
