#include <bits/stdc++.h>
int main() {
  int ele, n, x[110], y[110], p, q, e = 0, f = 0, i, e1 = 0, e2 = 0, o1 = 0,
                                    o2 = 0;
  char s1[300], s2[300];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
  for (i = 1; i <= n; i++) {
    if (x[i] % 2 == 0) e1++;
    if (x[i] % 2 != 0) {
      o1++;
      p = i;
      s2[f++] = (char)(i + 0);
    }
    if (y[i] % 2 == 0) e2++;
    if (y[i] % 2 != 0) {
      o2++;
      q = i;
      s1[e++] = (char)(i + 0);
    }
  }
  s2[f] = '\0';
  s1[e] = '\0';
  ele = strcmp(s1, s2);
  if (o1 % 2 == 0 && o2 % 2 == 0) {
    printf("0");
    goto label;
  }
  if (o1 % 2 != 0 && o2 % 2 == 0) {
    printf("-1");
    goto label;
  }
  if (o1 % 2 == 0 && o2 % 2 != 0) {
    printf("-1");
    goto label;
  }
  if (o1 % 2 != 0 && o2 % 2 != 0) {
    if (o1 > 1 || o2 > 1) {
      if (ele == 0)
        printf("-1");
      else
        printf("1");
    } else if (p == q)
      printf("-1");
    else
      printf("1");
  } else
    printf("0");
label:
  return 0;
}
