#include <bits/stdc++.h>
using namespace std;
long long POS(long long x) {
  if (x > 0)
    return x;
  else
    return 0;
}
struct ele {
  long double z, y, x;
  ele() {}
  ele(long double z, long double y, long double x) : z(z), y(y), x(x) {}
  ele operator+(const ele &p) const { return ele(z + p.z, y + p.y, x + p.x); }
  ele operator-(const ele &p) const { return ele(z - p.z, y - p.y, x - p.x); }
  ele operator*(long double con) const {
    return ele(z * con, y * con, x * con);
  }
  ele operator/(long double con) const {
    return ele(z / con, y / con, x / con);
  }
  bool operator<(const ele &rhs) const {
    return make_pair(z, make_pair(y, x)) <
           make_pair(rhs.z, make_pair(rhs.y, rhs.x));
  }
  bool operator==(const ele &rhs) const {
    return make_pair(z, make_pair(y, x)) ==
           make_pair(rhs.z, make_pair(rhs.y, rhs.x));
  }
};
int main() {
  int n;
  cin >> n;
  int oddup = 0, odddown = 0;
  vector<int> up(n);
  vector<int> down(n);
  for (int i = (0); i < (n); ++i) {
    cin >> up[i] >> down[i];
    if (up[i] % 2 != 0) oddup++;
    if (down[i] % 2 != 0) odddown++;
  }
  bool f = 0;
  if (oddup % 2 != 0 && odddown % 2 != 0) {
    bool f = 0;
    for (int i = (0); i < (n); ++i) {
      if ((up[i] % 2 != 0 && down[i] % 2 == 0) ||
          (up[i] % 2 == 0 && down[i] % 2 != 0)) {
        f = 1;
        break;
      }
    }
    if (f)
      printf("1\n");
    else
      printf("-1\n");
  } else if (odddown % 2 == 0 && oddup % 2 == 0) {
    printf("0\n");
  } else {
    printf("-1\n");
  }
}
