#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, u, l, oRowed = l = u = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (x % 2 != 0) {
      u++;
    }
    if (y % 2 != 0) {
      l++;
    }
    if (x % 2 != 0 && y % 2 != 0) {
      oRowed++;
    }
  }
  if (u % 2 == 0 && l % 2 == 0) {
    cout << 0;
  } else if ((u % 2 != 0 && l % 2 != 0 && u == l && u == oRowed) ||
             (u % 2 == 0 && l % 2 != 0) || (u % 2 != 0 && l % 2 == 0)) {
    cout << -1;
  } else {
    cout << 1;
  }
  return 0;
}
