1 #include<iostream>
2 #include<cstdio>
3 #include<algorithm>
4 #include<cstring>
5 #include<cmath>
6 #define N 210000
7 #define eps 1e-10
8 #define inf 1e15
9 using namespace std;
10
11 int n;
12
13 struct point
14 {
15 double x,y;
16 point(){};
17 point(double _x,double _y)
18 {
19 x=_x;y=_y;
20 }
21 }p[N];
22
23 point operator - (point a,point b)
24 {
25 return point(a.x-b.x,a.y-b.y);
26 }
27
28 point operator + (point a,point b)
29 {
30 return point(a.x+b.x,a.y+b.y);
31 }
32
33 point operator * (point a,double b)
34 {
35 return point(a.x*b,a.y*b);
36 }
37
38 point operator / (point a,double b)
39 {
40 return point(a.x/b,a.y/b);
41 }
42
43 int dcmp(double x)//三态函数
44 {
45 if(fabs(x)<eps)return 0;
46 if(x>eps)return 1;
47 return -1;
48 }
49
50 double cross(point a,point b)
51 {
52 return a.x*b.y-b.x*a.y;
53 }
54
55 struct line
56 {
57 point p,v;
58 int id;
59 double ang;
60 line(){};
61 line(point pp,point vv,int _id)
62 {
63 p=pp;v=vv;
64 ang=atan2(v.y,v.x);
65 id=_id;
66 }
67 friend bool operator < (line aa,line bb)
68 {
69 return aa.ang<bb.ang;
70 }
71 }lines[N],deq[N*2];
72
73 point getpoint(line a,line b)
74 {
75 point u=a.p-b.p;
76 double t=cross(b.v,u)/cross(a.v,b.v);
77 return a.p+a.v*t;
78 }
79
80 bool onright(point a,line b)
81 {
82 return cross(b.v,a-b.p)<0;
83 }
84 int tot,h,t;
85 void insert(line l)
86 {
87 while(h<t&&onright(p[t-1],l))t--;
88 while(h<t&&onright(p[h],l))h++;
89 deq[++t]=l;
90 if(h<t&&dcmp(deq[t].ang-deq[t-1].ang)==0)t--;
91 if(h<t)p[t-1]=getpoint(deq[t],deq[t-1]);
92 }
93
94 bool half(int cnt)
95 {
96 h=1;t=0;
97 for(int i=1;i<=2*n+4;i++)
98 {
99 if(lines[i].id<=cnt)
100 {
101 insert(lines[i]);
102 }
103 }
104 while(h<t&&onright(p[t-1],deq[h]))t--;
105 return t-h>=2;
106 }
107
108 int main()
109 {
110 scanf("%d",&n);
111 lines[++tot]=line(point(inf,inf),point(-1,0),0);
112 lines[++tot]=line(point(-inf,inf),point(0,-1),0);
113 lines[++tot]=line(point(-inf,-inf),point(1,0),0);
114 lines[++tot]=line(point(inf,-inf),point(0,1),0);
115 for(int i=1;i<=n;i++)
116 {
117 double x,y1,y2;
118 scanf("%lf%lf%lf",&x,&y1,&y2);
119 lines[++tot]=line(point(0,y1/x),point(1,-x),i);
120 lines[++tot]=line(point(0,y2/x),point(-1,x),i);
121 }
122 sort(lines+1,lines+2*n+5);
123 int ha=1,ta=n;
124 while(ha<=ta)
125 {
126 int mid=(ha+ta)>>1;
127 if(half(mid))
128 {
129 ha=mid+1;
130 }
131 else ta=mid-1;
132 }
133 printf("%d\n",ta);
134 return 0;
135 }