#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int odd1 = 0, odd2 = 0, even1 = 0, even2 = 0, sum1 = 0, sum2 = 0;
  vector<pair<int, int>> v(n);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (x % 2 == 0) {
      even1++;
    } else {
      odd1++;
    }
    if (y % 2 == 0) {
      even2++;
    } else {
      odd2++;
    }
    sum1 += x;
    sum2 += y;
    v[i] = {x, y};
  }
  if (sum1 % 2 == 0 && sum2 % 2 == 0) {
    cout << 0;
  } else if (sum1 % 2 == 0 || sum2 % 2 == 0) {
    cout << -1;
  } else {
    for (int i = 0; i < n; i++) {
      int x = v[i].first, y = v[i].second;
      if (x % 2 == 0 && y % 2 == 1 || x % 2 == 1 && y % 2 == 0) {
        cout << 1;
        return 0;
      }
    }
    cout << -1;
  }
  return 0;
}
