#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-15;
int cmp(double x) { return x < -eps ? -1 : (x > eps); }
int n;
struct node {
  pair<double, double> a, b, w;
  double h, v;
  void getwi() {
    w = make_pair((a.first + b.first) / 2.0, (a.second + b.second) / 2.0);
  }
  bool in(pair<double, double> p) {
    return cmp(p.first - a.first) >= 0 && cmp(p.first - b.first) <= 0 &&
           cmp(p.second - a.second) >= 0 && cmp(p.second - b.second) <= 0;
  }
};
node gp[120];
struct wi {
  pair<double, double> p;
  double v;
  wi() {}
};
bool check(int pos) {
  wi w;
  gp[pos].getwi();
  w.p = gp[pos].w;
  w.v = gp[pos].v;
  for (int i = (pos - 1); i >= (0); i--) {
    if (!gp[i].in(w.p)) {
      return false;
    }
    w.p.first = (w.p.first * w.v + gp[i].w.first * gp[i].v) / (w.v + gp[i].v);
    w.p.second =
        (w.p.second * w.v + gp[i].w.second * gp[i].v) / (w.v + gp[i].v);
    w.v += gp[i].v;
  }
  return true;
}
int main() {
  cin >> n;
  int ans = 0, f = 0;
  for (int i = 0; i < (n); i++) {
    cin >> gp[i].a.first >> gp[i].a.second;
    cin >> gp[i].b.first >> gp[i].b.second;
    if (f) continue;
    if (gp[i].a.first > gp[i].b.first) swap(gp[i].a.first, gp[i].b.first);
    if (gp[i].a.second > gp[i].b.second) swap(gp[i].a.second, gp[i].b.second);
    gp[i].h = fabs(gp[i].a.first - gp[i].b.first);
    gp[i].v = ((gp[i].h) * (gp[i].h) * (gp[i].h));
    if (check(i))
      ++ans;
    else
      f = 1;
  }
  cout << ans << endl;
}
