#include <bits/stdc++.h>
using namespace std;
struct info {
  int x, y;
} I;
int main() {
  int n, i, x, y, totalX = 0, totalY = 0;
  cin >> n;
  vector<info> V;
  for (i = 0; i < n; i++) {
    cin >> I.x >> I.y;
    totalX += I.x;
    totalY += I.y;
    V.push_back(I);
  }
  if (totalX % 2 == 0 && totalY % 2 == 0)
    cout << 0;
  else {
    int flag = 0;
    for (i = 0; i < n; i++) {
      if ((totalX - V[i].x + V[i].y) % 2 == 0 &&
          (totalY - V[i].y + V[i].x) % 2 == 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 1)
      cout << 1;
    else
      cout << -1;
  }
  return 0;
}
