题目描述
Problem Description
Takahashi is challenging a rhythm game as follows:
- There are $ N $ large buttons. Exactly one person is needed to press each button, and there is no other way to press it.
- One person cannot press two or more buttons at the same time.
- Pressing the $ i $th button from time $ S_i $ to time $ T_i $ continuously will earn 1 point. It is not necessary for the same person to press the button from start to end; it is acceptable to change the person pressing the button during this period.
- The time required to step on or off the buttons, or to change the person pressing the button, is negligible.
Takahashi wants to play this game with some cooperation to score at least $ N-1 $ points. Find the minimum number of people required to achieve at least $ N-1 $ points.
Input Format
The input is given from the standard input in the following format:
$ N $ $ S_1 $ $ T_1 $ $ S_2 $ $ T_2 $ : $ S_N $ $ T_N $
- The first line contains an integer $N\ (2\ ≦\ N\ ≦\ 10^5)$, representing the number of buttons.
- The next $ N $ lines contain the information for each button. The $i\ (1\ ≦\ i\ ≦\ N)$th line contains two integers $S_i,\ T_i\ (1\ ≦\ S_i\ <\ T_i\ ≦\ 10^5)$, indicating that pressing the $ i $th button from time $ S_i $ to time $ T_i $ continuously will earn 1 point.
Output Format
Output the minimum number of people required to score at least $ N-1 $ points in one line. End the output with a newline.
Sample Input and Output
Sample Input #1
4
1 4
1 2
2 3
3 4
Sample Output #1
1
Sample Input #2
5
5 11
2 4
3 4
2 7
5 7
Sample Output #2
2
Sample Input #3
4
1 2
1 2015
2015 100000
99999 100000
Sample Output #3
2
Notes/Hints
Sample Explanation 1
The figure below shows the time periods during which points can be earned by pressing each button. By having one person press all buttons except button $ 1 $, 3 points can be earned. 
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
4
1 4
1 2
2 3
3 4
样例输出
1