#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
int x[111][2], y[111][2];
const double eps = 1e-9;
bool eq(double a, double b) { return abs(a - b) < eps; }
bool leq(double a, double b) { return a < b || eq(a, b); }
int main() {
  int n;
  cin >> n;
  for (int(i) = 0; (i) < (n); (i)++)
    cin >> x[i][0] >> y[i][0] >> x[i][1] >> y[i][1];
  for (int iter = 1; iter < n; iter++) {
    double SX = 0;
    double SY = 0;
    double M = 0;
    for (int i = iter; i >= 1; i--) {
      double m = (double)(x[i][0] - x[i][1]) * (x[i][0] - x[i][1]) *
                 (x[i][0] - x[i][1]);
      m = abs(m);
      M += m;
      SX += m * ((double)(x[i][0] + x[i][1]) / 2);
      SY += m * (double)(y[i][0] + y[i][1]) / 2;
      double xc = SX / M;
      double yc = SY / M;
      if (!(leq(min(x[i - 1][0], x[i - 1][1]), xc) &&
            leq(xc, max(x[i - 1][0], x[i - 1][1])) &&
            leq(min(y[i - 1][0], y[i - 1][1]), yc) &&
            leq(yc, max(y[i - 1][0], y[i - 1][1])))) {
        cout << iter;
        return 0;
      }
    }
  }
  cout << n;
  return 0;
}
