#include <bits/stdc++.h>
using namespace std;
int n, i, j, a[100][2], s1, s2, f = -1;
int main() {
  for (cin >> n; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    s1 += a[i][0];
    s2 += a[i][1];
  }
  if (s1 % 2 + s2 % 2 == 0)
    cout << 0;
  else {
    for (i = 0; i < n; i++) {
      swap(a[i][0], a[i][1]);
      s1 = s2 = 0;
      for (j = 0; j < n; j++) s1 += a[j][0], s2 += a[j][1];
      if (s1 % 2 + s2 % 2 == 0) f = 1;
      swap(a[i][0], a[i][1]);
    }
    cout << f;
  }
}
