Preliminary Meeting Result Report
InterviewTime limit1sMemory limit1024 MB
Count the teams that solved at least one of three problems, where each solve time is no earlier than the solve time of any lower-numbered problem.
- Level
Easy2 of 10
- Topics
- Implementation, Array
- Solved
- No attempts yet
Problem
The day before the PPC main contest, a preliminary meeting is held so that the participating teams can adapt to the environment. The preliminary meeting used problems, and teams took part. Problems and teams are numbered in order starting from . The PPC staff decided to write a report to find out how effective the preliminary meeting was.
To measure the effect, you need to count the teams that took part diligently. A diligent team satisfies the following conditions.
- The team solved at least one of the three problems.
- The team solved the problems in order of their numbers. That is, if a team solved a problem at time , it had solved every problem with a smaller number, each at time or earlier, and every problem with a larger number is either unsolved or solved at time or later.
Given the time each team solved each problem, find the number of diligent teams.
Input
The first line contains the number of teams that took part in the preliminary meeting. ()
From the second line, lines follow. Line contains three integers , , separated by spaces, which are the times at which team solved problems 1, 2, and 3. If team did not solve problem , then . ()
Output
Print the number of diligent teams.