#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> uh, lh;
  int sum1, sum2, ans;
  sum1 = sum2 = ans = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    sum1 += x;
    sum2 += y;
    uh.push_back(x);
    lh.push_back(y);
  }
  if (sum1 % 2 == 0 && sum2 % 2 == 0)
    ans = 0;
  else if ((sum1 % 2 != 0 && sum2 % 2 == 0) || (sum1 % 2 == 0 && sum2 % 2 != 0))
    ans = -1;
  else {
    for (int i = 0; i < n; i++) {
      ans = -1;
      if ((uh[i] % 2 == 0 && lh[i] % 2 != 0) ||
          (uh[i] % 2 != 0 && lh[i] % 2 == 0)) {
        ans = 1;
        break;
      }
    }
  }
  cout << ans;
}
