#include <bits/stdc++.h>
int main() {
  int n, j, i, flag = 0, c = 0, sx = 0, sy = 0;
  scanf("%d", &n);
  int x[n], y[n];
  for (i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
    if ((x[i] % 2 == 0 && y[i] % 2 != 0) || (x[i] % 2 != 0 && y[i] % 2 == 0))
      flag = 1;
    sx = sx + x[i];
    sy = sy + y[i];
  }
  if (sx % 2 == 0 && sy % 2 == 0) {
    printf("0");
  } else if ((sx % 2 == 0 && sy % 2 != 0) || (sx % 2 != 0 && sy % 2 == 0)) {
    printf("-1");
  } else if (flag == 1)
    printf("1");
  else
    printf("-1");
  return 0;
}
