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