#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  float count = 1, p1[n][2], p2[n][2];
  for (int i = 0; i < n; i++) {
    cin >> p1[i][0] >> p1[i][1] >> p2[i][0] >> p2[i][1];
  }
  for (int i = 1; i < n; i++) {
    float midx = abs(p1[i][0] - p2[i][0]) / 2 + min(p1[i][0], p2[i][0]);
    float midy = abs(p1[i][1] - p2[i][1]) / 2 + min(p1[i][1], p2[i][1]);
    bool fall = false;
    float mass1 = pow(abs(p1[i][0] - p2[i][0]), 3);
    for (int j = i - 1; j >= 0; j--) {
      float x1, y1, x2, y2;
      if (p1[j][0] <= p2[j][0]) {
        x1 = p1[j][0];
        x2 = p2[j][0];
      } else {
        x2 = p1[j][0];
        x1 = p2[j][0];
      }
      if (p1[j][1] <= p2[j][1]) {
        y1 = p1[j][1];
        y2 = p2[j][1];
      } else {
        y2 = p1[j][1];
        y1 = p2[j][1];
      }
      if (x1 <= midx && midx <= x2 && y1 <= midy && midy <= y2) {
        float rmidx = abs(x1 - x2) / 2 + x1;
        float rmidy = abs(y1 - y2) / 2 + y1;
        float mass2 = pow(abs(x1 - x2), 3);
        midx = (mass2 * rmidx + mass1 * midx) / (mass1 + mass2);
        midy = (mass2 * rmidy + mass1 * midy) / (mass1 + mass2);
        mass1 += mass2;
      } else {
        fall = true;
        break;
      }
    }
    if (!fall)
      count++;
    else
      break;
  }
  cout << count << endl;
}
