#T655. 小Tu看电视
小Tu看电视
Description
Winter vacation has arrived, and Xiao Tu can finally enjoy watching TV happily. However, there are too many programs he likes, and he hopes to watch as many complete programs as possible.
Now he has given you the broadcast schedule of his favorite TV programs. Can you help him arrange a reasonable viewing plan?
Input Format
The input contains multiple test cases. The first line of each test case is an integer n (n ≤ 100), representing the total number of programs Xiao Tu likes.
The next n lines each contain two integers si and ei (1 ≤ i ≤ n), indicating the start and end times of the i-th program. To simplify the problem, each time is represented by a positive integer.
When n = 0, the input ends.
Output Format
For each test case, output the number of TV programs that can be watched completely.
```input1 12 1 3 3 4 0 7 3 8 15 19 15 20 10 15 8 18 6 12 5 10 4 14 2 9 0 ``` ```output1 5 ``` ## 译文CodesOnline