#include <bits/stdc++.h>
using namespace std;
int n, x[100009], y[100009], sx, sy;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    sx += x[i];
    sy += y[i];
  }
  if (sx % 2 == 0 && sy % 2 == 0) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if ((sx - x[i] + y[i]) % 2 == 0 && (sy - y[i] + x[i]) % 2 == 0) {
      cout << 1;
      return 0;
    }
  }
  cout << -1;
}
