#include <bits/stdc++.h>
using namespace std;
int mini(int l, int r) {
  if (l < r)
    return l;
  else
    return r;
}
int main() {
  int n;
  while (cin >> n) {
    vector<pair<int, int> > v(n);
    int xodd = 0;
    int yodd = 0;
    int xyodd = 0;
    for (int i = 0; i < n; i++) {
      cin >> v[i].first >> v[i].second;
      if (v[i].first % 2 == 1 && v[i].second % 2 == 1)
        xyodd++;
      else if (v[i].first % 2 == 1)
        xodd++;
      else if (v[i].second % 2 == 1)
        yodd++;
    }
    int savexodd = xodd;
    int saveyodd = yodd;
    xyodd %= 2;
    xodd %= 2;
    yodd %= 2;
    if (xyodd == 0) {
      if (xodd == 1 && yodd == 1) {
        cout << 1 << endl;
      } else if (xodd == 0 && yodd == 0) {
        cout << 0 << endl;
      } else
        cout << -1 << endl;
    } else {
      if (xodd == 1 && yodd == 1) {
        cout << 0 << endl;
      } else if (xodd == 0 && yodd == 0) {
        if (savexodd == 0 && saveyodd == 0)
          cout << -1 << endl;
        else
          cout << 1 << endl;
      } else
        cout << -1 << endl;
    }
  }
  return 0;
}
