#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int oup = 0, odown = 0;
  vector<int> up(n);
  vector<int> down(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> up[i] >> down[i];
    if (up[i] % 2 != 0) oup++;
    if (down[i] % 2 != 0) odown++;
  }
  bool f = 0;
  if (oup % 2 != 0 && odown % 2 != 0) {
    bool f = 0;
    for (i = 0; i < n; i++) {
      if ((up[i] % 2 != 0 && down[i] % 2 == 0) ||
          (up[i] % 2 == 0 && down[i] % 2 != 0)) {
        f = 1;
        break;
      }
    }
    if (f)
      printf("1\n");
    else
      printf("-1\n");
  } else if (odown % 2 == 0 && oup % 2 == 0) {
    printf("0\n");
  } else {
    printf("-1\n");
  }
}
