#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int x[n];
  int sumx = 0;
  int sumy = 0;
  int y[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    sumx += x[i];
    sumy += y[i];
  }
  if (sumx % 2 == 0) {
    if (sumy % 2 == 0) {
      cout << "0";
      return 0;
    } else {
      cout << "-1";
      return 0;
    }
  } else {
    if (sumy % 2 == 0) {
      cout << "-1";
      return 0;
    } else {
      for (int i = 0; i < n; i++) {
        if ((x[i] % 2 == 0 && y[i] % 2 == 1) ||
            (x[i] % 2 == 1 && y[i] % 2 == 0)) {
          cout << "1";
          return 0;
        }
      }
      cout << "-1";
      return 0;
    }
  }
  return 0;
}
