#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100], b[100], oa = 0, ob = 0, ore = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] % 2 == 1) oa++;
    if (b[i] % 2 == 1) ob++;
    if (a[i] % 2 == 1 && b[i] % 2 == 1) ore++;
  }
  if (oa % 2 == 0 && ob % 2 == 0)
    cout << 0;
  else if (oa % 2 == 1 && ob % 2 == 0 || oa % 2 == 0 && ob % 2 == 1 ||
           oa - ore == 0 && ob - ore == 0)
    cout << -1;
  else
    cout << 1;
}
