#include <bits/stdc++.h>
using namespace std;
vector<int> x;
vector<int> y;
int main() {
  int n, a = 0, b = 0, c = -1;
  cin >> n;
  x.resize(n);
  y.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    a += x[i];
    b += y[i];
  }
  if (a % 2 == 0 && b % 2 == 0)
    cout << 0 << endl;
  else {
    for (int i = 0; i < n; i++) {
      if ((a - x[i] + y[i]) % 2 == 0 && (b - y[i] + x[i]) % 2 == 0) {
        c = 1;
      }
    }
    cout << c << endl;
  }
  return 0;
}
