#include <bits/stdc++.h>
using namespace std;
bool isEven(int x) { return x % 2 == 0; }
bool isOdd(int x) { return x % 2; }
int main() {
  int n, x, y;
  pair<int, int> p[111];
  int sumU = 0, sumD = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    p[i] = make_pair(x, y);
    sumU += x;
    sumD += y;
  }
  if (isEven(sumU) && isEven(sumD))
    printf("0");
  else if ((isEven(sumU) && isOdd(sumD)) || (isOdd(sumU) && isEven(sumD)))
    printf("-1");
  else {
    bool found = 0;
    for (int i = 0; i < n; i++)
      if ((isEven(p[i].first) && isOdd(p[i].second)) ||
          (isOdd(p[i].first) && isEven(p[i].second)))
        found = 1;
    if (found)
      printf("1");
    else
      printf("-1");
  }
  return 0;
}
