#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b, c = 0, d = 0;
  cin >> n;
  vector<pair<long long int, long long int> > v;
  for (long long int i = 0; i < n; i++) {
    cin >> a >> b;
    v.push_back(make_pair(a, b));
    if (a % 2 != 0) c++;
    if (b % 2 != 0) d++;
  }
  if (c % 2 == 0 and d % 2 == 0)
    cout << "0";
  else {
    for (long long int i = 0; i < n; i++) {
      if (v[i].first % 2 != 0 and v[i].second % 2 == 0) {
        c--;
        d++;
      } else if (v[i].first % 2 == 0 and v[i].second % 2 != 0) {
        c++;
        d--;
      }
      if (c % 2 == 0 and d % 2 == 0) {
        cout << "1";
        return 0;
      }
    }
    cout << "-1";
  }
}
