#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int upper[101], lower[101];
  int sum1 = 0, sum2 = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &upper[i], &lower[i]);
    upper[i] = upper[i] % 2;
    lower[i] = lower[i] % 2;
    sum1 += upper[i];
    sum2 += lower[i];
  }
  if ((sum1 % 2) + (sum2 % 2) == 0)
    printf("0\n");
  else if ((sum1 % 2) + (sum2 % 2) == 1)
    printf("-1\n");
  else {
    bool flag = false;
    for (int i = 0; i < n; i++) {
      if (upper[i] + lower[i] == 1) {
        flag = true;
        break;
      }
    }
    if (flag)
      printf("1\n");
    else
      printf("-1\n");
  }
  return 0;
}
