#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 0, 0, -1, 1}, dj[] = {0, 1, -1, 0, 0};
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
int x[109], y[109];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int xod = 0, yod = 0, smx = 0, smy = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    if (x[i] & 1) xod++;
    if (y[i] & 1) yod++;
    smx += x[i];
    smy += y[i];
  }
  if (!(xod & 1) && !(yod & 1)) {
    cout << 0;
    return 0;
  }
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (((x[i] & 1) && !(y[i] & 1)) || (!(x[i] & 1) && (y[i] & 1))) {
      smx -= x[i];
      smx += y[i];
      smy -= y[i];
      smy += x[i];
      res++;
    }
    if (!(smx & 1) && !(smy & 1)) {
      cout << 1;
      return 0;
    }
  }
  cout << -1;
  return 0;
}
