#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long n, s = 0, ss = 0, cnt = 0;
  cin >> n;
  long long x = n;
  vector<pair<long long, long long> > v;
  while (n--) {
    long long a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
    s += a;
    ss += b;
  }
  if ((s % 2 == 1 && ss % 2 == 0) || (s % 2 == 0 && ss % 2 == 1))
    return cout << -1 << '\n', 0;
  if (x == 1 && (s + ss) % 2 == 1) return cout << -1 << '\n', 0;
  if (s % 2 == 0 && ss % 2 == 0) return cout << 0 << '\n', 0;
  for (long long i = 0; i < x; i++) {
    if ((v[i].first % 2 == 1 && v[i].second % 2 == 0) ||
        (v[i].first % 2 == 0 && v[i].second % 2 == 1))
      cnt++;
  }
  if (cnt > 0)
    cout << 1 << '\n';
  else
    cout << -1 << '\n';
}
