题目描述
Problem Description
After learning Tai Chi, Bob asks Alice to teach him Tai Chi Sword. Alice tells him that he first needs to pass a basic swordsmanship test. The test requires Bob to cut as many ropes as quickly as possible.
All the rope ends are different, so there are a total of $2n$ ends. These ends are bundled in a circle, equidistantly distributed. We number these ends clockwise from $1$ to $2n$.
Each of Bob's cuts is a straight line that can cut all the ropes that intersect with this line. He wants to know the minimum number of cuts required to cut all the ropes.
Input Format
The first line contains an integer $n(1 \leq n \leq 2 \times 10^5)$, representing the number of ropes.
The next $n$ lines each contain two integers $a_i, b_i(1 \leq a_i, b_i \leq 2n, a_i \neq b_i)$, representing the two end points of the $i$-th rope.
Output Format
A single line containing an integer, representing the answer.
Sample Input and Output
Sample Input #1
2
1 2
3 4
Sample Output #1
1
Sample Input #2
3
1 2
3 4
5 6
Sample Output #2
2
Sample Input #3
3
1 3
2 4
5 6
Sample Output #3
1
Notes
Explanation for Sample 1: 
Explanation for Sample 2: 
Explanation for Sample 3: 
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分