#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x, y;
  int flag = 0;
  int su = 0, sl = 0;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    su += x;
    sl += y;
    v.push_back(make_pair(x, y));
  }
  if (su % 2 == 0 and sl % 2 == 0) {
    cout << "0\n";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    x = v[i].first;
    y = v[i].second;
    pair<int, int> a = make_pair(y, x);
    v[i] = a;
    su = 0, sl = 0;
    for (int j = 0; j < n; j++) {
      su += v[j].first;
      sl += v[j].second;
    }
    if (su % 2 == 0 and sl % 2 == 0) {
      cout << "1\n";
      return 0;
    }
  }
  cout << "-1\n";
  return 0;
}
