#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  long long int sum_1 = 0, sum_2 = 0, c = 0;
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> a[i] >> b[i];
    sum_1 += a[i];
    sum_2 += b[i];
  }
  if (sum_1 % 2 == 0 && sum_2 % 2 == 0) {
    cout << "0" << '\n';
  } else if (n == 1) {
    cout << "-1" << '\n';
  } else {
    for (long long int i = 0; i <= n - 1; i++) {
      sum_1 -= a[i];
      sum_1 += b[i];
      sum_2 -= b[i];
      sum_2 += a[i];
      c++;
      if (sum_1 % 2 == 0 && sum_2 % 2 == 0) {
        cout << c << '\n';
        return 0;
      }
      c--;
      sum_1 -= b[i];
      sum_1 += a[i];
      sum_2 -= a[i];
      sum_2 += b[i];
    }
    cout << "-1" << '\n';
  }
  return 0;
}
