#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100], b[100], sa = 0, sb = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] % 2 != 0) sa++;
    if (b[i] % 2 != 0) sb++;
  }
  if (sa % 2 == 0 && sb % 2 == 0) {
    cout << "0";
    exit(0);
  } else if (sa % 2 != 0 && sb % 2 != 0) {
    bool f = true;
    for (int i = 0; f && i < n; i++) {
      if (a[i] % 2 == 0 && b[i] % 2 != 0) {
        cout << "1";
        f = false;
      } else if (a[i] % 2 != 0 && b[i] % 2 == 0) {
        cout << "1";
        f = false;
      }
    }
    if (f) cout << "-1";
  } else
    cout << "-1";
}
