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