Invigilation

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

The Smurfs have built the Great Smurfy Wall.  The wall consists of a sequence of points connected by straight wall segments. Smurfs have also built towers on some of those points.  Now Gargamel needs to observe all those towers, but he can't do this himself because wall segments can obscure his vision (although it is possible to see all towers along the wall).  He wants to place some cameras along a highway that passes nearby the wall.  However the cameras are very expensive so Gargamel asked you to tell him the minimal number of cameras he needs.

입력

First line of input contains integers nn and HH (1n1051 \leq n \leq 10^5, 1H1061 \leq H \leq 10^6). nn is the number of points of the wall, and HH specifies that highways is the line with y=Hy = H. The next nn lines describe the Great Smurfy Wall.  Each of those lines contains three integers x_i,y_i,z_ix\_i, y\_i, z\_i (0x_i1060 \leq x\_i \leq 10^6, 0y_i<H0 \leq y\_i < H, z_i0,1z\_i \in \\{0,1\\}), (x_i,y_i)(x\_i, y\_i) are the coordinates of a point, and z_i=1z\_i = 1 iff there's a tower at that point.  y_1y\_1 and y_ny\_n are always 00, and the points are given in the order of strictly increasing x_ix\_i.

출력

Output the minimal number of cameras Gargamel needs to use.