#include <bits/stdc++.h>
using namespace std;
inline int Sum(int a[], int n) {
  int i, sum = a[0];
  for (i = 1; i < n; i++) {
    sum += a[i];
  }
  return sum;
}
int main() {
  int n, i;
  cin >> n;
  int x[100];
  int y[100];
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  int sumu = Sum(x, n);
  int suml = Sum(y, n);
  if (sumu % 2 == 0 && suml % 2 == 0) {
    cout << "0";
  } else if ((sumu % 2 == 0 && suml % 2 != 0) ||
             (suml % 2 == 0 && sumu % 2 != 0)) {
    cout << "-1";
  } else {
    i = 0;
    while (i < n) {
      if ((x[i] - y[i]) % 2 != 0) {
        cout << "1";
        break;
      }
      i++;
    }
    if (i == n) {
      cout << "-1";
    }
  }
  return 0;
}
