#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<vector<double>> arr(N, vector<double>(7, 0));
  for (int n = 0; n < N; n++) {
    cin >> arr[n][0] >> arr[n][1] >> arr[n][2] >> arr[n][3];
    arr[n][4] = (arr[n][0] + arr[n][2]) / 2;
    arr[n][5] = (arr[n][1] + arr[n][3]) / 2;
    arr[n][6] = arr[n][0] > arr[n][2] ? (arr[n][0] - arr[n][2])
                                      : (arr[n][2] - arr[n][0]);
    arr[n][6] = arr[n][6] * arr[n][6] * arr[n][6];
  }
  int res = 0;
  for (int n = 1; n < N; n++) {
    double cnt = 0;
    double x = 0;
    double y = 0;
    bool st = true;
    for (int j = n; j > 0; j--) {
      x = (x * cnt + arr[j][6] * arr[j][4]) / (cnt + arr[j][6]);
      y = (y * cnt + arr[j][6] * arr[j][5]) / (cnt + arr[j][6]);
      if ((arr[j - 1][0] > arr[j - 1][2] &&
           (x > arr[j - 1][0] || x < arr[j - 1][2])) ||
          (arr[j - 1][0] < arr[j - 1][2] &&
           (x < arr[j - 1][0] || x > arr[j - 1][2])) ||
          (arr[j - 1][1] < arr[j - 1][3] &&
           (y < arr[j - 1][1] || y > arr[j - 1][3])) ||
          (arr[j - 1][1] > arr[j - 1][3] &&
           (y > arr[j - 1][1] || y < arr[j - 1][3]))) {
        st = false;
        break;
      }
      cnt += arr[j][6];
    }
    if (st) {
      res++;
    } else {
      break;
    }
  }
  cout << res + 1 << endl;
  return 0;
}
