#include <bits/stdc++.h>
using namespace std;
bool good(int x, int y) { return (x % 2) and !(y % 2); }
int calc(int n, const vector<pair<int, int>> &v) {
  pair<long long, long long> sum;
  sum.first = sum.second = 0;
  bool g = false;
  for (const auto &it : v) {
    sum.first += it.first;
    sum.second += it.second;
    if (good(it.first, it.second) or good(it.second, it.first)) g = true;
  }
  if (!(sum.first % 2)) {
    if (!(sum.second % 2)) return 0;
  } else {
    if (sum.second % 2 and g) return 1;
  }
  return -1;
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> v(n);
  for (auto &ent : v) cin >> ent.first >> ent.second;
  cout << calc(n, v) << "\n";
  return 0;
}
