#include <bits/stdc++.h>
using namespace std;
long double x1[200], x2[200], y11[200], y2[200];
long double m[200];
long double xc[200][200];
long double yc[200][200];
long double xx1[200], xx2[200], yy1[200], yy2[200];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1[i] >> y11[i] >> x2[i] >> y2[i];
    if (x1[i] > x2[i]) swap(x1[i], x2[i]);
    if (y11[i] > y2[i]) swap(y11[i], y2[i]);
    m[i] = abs(x1[i] - x2[i]) * abs(x1[i] - x2[i]) * abs(x1[i] - x2[i]);
    if (i == 0) {
      xx1[i] = x1[i];
      xx2[i] = x2[i];
      yy1[i] = y11[i];
      yy2[i] = y2[i];
    } else {
      xx1[i] = max(x1[i], x1[i - 1]);
      yy1[i] = max(y11[i], y11[i - 1]);
      xx2[i] = min(x2[i], x2[i - 1]);
      yy2[i] = max(y2[i], y2[i - 1]);
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++) {
      long double X = 0;
      long double Y = 0;
      long double M = 0;
      for (int k = i; k <= j; k++) {
        X += 0.5 * (x1[k] + x2[k]) * m[k];
        Y += 0.5 * (y11[k] + y2[k]) * m[k];
        M += m[k];
      }
      xc[i][j] = X / M;
      yc[i][j] = Y / M;
    }
  int res = 0;
  for (int i = 0; i < n; i++) {
    bool ok = true;
    for (int j = 0; ok && j <= i; j++) {
      if ((xc[j][i] - xx1[j]) * (xc[j][i] - xx2[j]) <= 1e-13 &&
          (yc[j][i] - yy1[j]) * (yc[j][i] - yy2[j]) <= 1e-13) {
      } else
        ok = false;
    }
    if (ok)
      res++;
    else
      break;
  }
  cout << res << endl;
  return 0;
}
