#include <bits/stdc++.h>
const int maxn = 1e3 + 10;
using namespace std;
int n, x[110], y[110], cnt1, cnt2, sum1, sum2;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    if (x[i] % 2 == 1) {
      cnt1++;
    }
    if (y[i] % 2 == 1) {
      cnt2++;
    }
    sum1 += x[i];
    sum2 += y[i];
  }
  if (cnt1 % 2 == 0 && cnt2 % 2 == 0) {
    if (sum1 % 2 == 0 && sum2 % 2 == 0) {
      cout << "0";
      return 0;
    } else {
      for (int i = 0; i < n; i++) {
        if (x[i] % 2 == 0 && y[i] % 2 == 1) {
          cout << "1";
          return 0;
        } else if (x[i] % 2 == 1 && y[i] % 2 == 0) {
          cout << "1";
          return 0;
        }
      }
    }
  } else if (cnt1 % 2 == 1 && cnt2 % 2 == 1) {
    for (int i = 0; i < n; i++) {
      if (x[i] % 2 == 0 && y[i] % 2 == 1) {
        cout << "1";
        return 0;
      } else if (x[i] % 2 == 1 && y[i] % 2 == 0) {
        cout << "1";
        return 0;
      }
    }
  }
  cout << "-1";
  return 0;
}
