#include <bits/stdc++.h>
using namespace std;
const int N = 111;
int n;
double x[N], y[N], w[N];
double ax[N], ay[N], bx[N], by[N];
int main() {
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%lf%lf%lf%lf", ax + i, ay + i, bx + i, by + i);
    if (ax[i] > bx[i]) swap(ax[i], bx[i]);
    if (ay[i] > by[i]) swap(ay[i], by[i]);
    x[i] = (ax[i] + bx[i]) * .5;
    y[i] = (ay[i] + by[i]) * .5;
    w[i] = pow(fabs(ax[i] - bx[i]), 3);
    double tw = w[i], tx = x[i], ty = y[i];
    bool ok = true;
    for (int j = i - 1; j >= 0; --j) {
      if (tx < ax[j] || tx > bx[j]) {
        ok = false;
        break;
      }
      if (ty < ay[j] || ty > by[j]) {
        ok = false;
        break;
      }
      tx = (tx * tw + x[j] * w[j]) / (tw + w[j]);
      ty = (ty * tw + y[j] * w[j]) / (tw + w[j]);
      tw += w[j];
    }
    if (!ok) break;
    ++ans;
  }
  cout << ans << endl;
}
