#include <bits/stdc++.h>
using namespace std;
int main() {
  ;
  int n;
  while (scanf("%d", &n) == 1) {
    vector<pair<double, double> > b(n);
    vector<int> a(n);
    vector<double> w(n);
    vector<double> cw(n);
    vector<pair<double, double> > cb(n);
    int more = true;
    int stable = 0;
    for (int i = (0); i <= ((n)-1); ++i) {
      int x1, y1, x2, y2;
      scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
      if (!more) continue;
      b[i] = pair<double, double>((x1 + x2) * .5, (y1 + y2) * .5);
      a[i] = ((x1 - x2) < 0 ? -(x1 - x2) : (x1 - x2));
      w[i] = a[i] * 1. * a[i] * 1. * a[i];
      for (int j = (0); j <= ((i)-1); ++j) {
        cb[j].first += w[i] * b[i].first;
        cb[j].second += w[i] * b[i].second;
        cw[j] += w[i];
      }
      cb[i] = pair<double, double>(w[i] * b[i].first, w[i] * b[i].second);
      cw[i] = w[i];
      bool ok = true;
      for (int j = (1); j <= ((i)); ++j) {
        pair<double, double> cg(cb[j].first / cw[j], cb[j].second / cw[j]);
        if (((cg.first - b[j - 1].first) < 0
                 ? -(cg.first - b[j - 1].first)
                 : (cg.first - b[j - 1].first)) > a[j - 1] * .5 + 1e-9)
          ok = false;
        if (((cg.second - b[j - 1].second) < 0
                 ? -(cg.second - b[j - 1].second)
                 : (cg.second - b[j - 1].second)) > a[j - 1] * .5 + 1e-9)
          ok = false;
      }
      if (ok)
        ++stable;
      else
        more = false;
    }
    cout << stable << endl;
  }
  return 0;
}
