#include <bits/stdc++.h>
using namespace std;
const long long int MAX = 1000000007;
const long long int MAXN = 100005;
int solve() {
  int n, sx = 0, sy = 0, ans = -1;
  cin >> n;
  int x[n], y[n];
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    sx += x[i];
    sy += y[i];
  }
  if (sx % 2 == 0 && sy % 2 == 0)
    cout << "0" << endl;
  else if (sx % 2 == 0 && sy % 2 == 1 || sx % 2 == 1 && sy % 2 == 0) {
    cout << "-1";
  } else if (sx % 2 == 1 && sy % 2 == 1) {
    for (int i = 0; i < n; i++) {
      if (x[i] % 2 == 0 && y[i] % 2 == 1 || x[i] % 2 == 1 && y[i] % 2 == 0) {
        ans = 1;
        break;
      }
    }
    cout << ans;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  solve();
  return 0;
}
