#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x[100], y[100], s11 = 0, s1 = 0, s0 = 0;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    x[i] = a % 2;
    y[i] = b % 2;
    if (x[i] == 1 && y[i] == 1)
      ++s11;
    else if (x[i])
      ++s1;
    else if (x[i] == 0 && y[i])
      ++s0;
  }
  if (s11 % 2 == 0) {
    if (s1 % 2 == 0 && s0 % 2 == 0)
      cout << 0;
    else if (s1 % 2 == 0 && s0 % 2 == 1)
      cout << -1;
    else if (s1 % 2 == 1 && s0 % 2 == 0)
      cout << -1;
    else if (s1 % 2 == 1 && s0 % 2 == 1)
      cout << 1;
  } else {
    if (s1 == 0 && s0 == 0)
      cout << -1;
    else if (s1 % 2 == 0 && s0 % 2 == 0)
      cout << 1;
    else if (s1 % 2 == 0 && s0 % 2 == 1)
      cout << -1;
    else if (s1 % 2 == 1 && s0 % 2 == 0)
      cout << -1;
    else if (s1 % 2 == 1 && s0 % 2 == 1)
      cout << 0;
  }
  cout << endl;
  return 0;
}
