Study Qualifications

Study Qualifications

No Chinese version yet.

Background

Hooch caught \(n\) students who shouted his nickname.

Description

Hooch decided to give all students a chance to mend their mistakes. So he made these student tell him what they did and how to do after that. The \(i\)th student wanted to do that from the \(l_i\)th minute to the \(r_i\)th minute.
But Hooch only had two ears, so he could only listen to two students at the same time. So there must be somebody Hooch couldn't listen to. For these students, Hooch would cancel their study qualifications.
The OHO (No.One Secondary School Hooch Organization) wants to know, how many students could stay at school at most? If the end time of a student was the same as another student's start time, the two student could become one student. (merge/HEBING)

Format

Input \(n\) in the first line.
The \(2\)nd to the \(n+1\)th line: each line has two intergers \(l_i\) and \(r_i\).

Please print the answer.

Sample

Input

3
1 3
2 4
3 5

Output

3

Limitation

1s, 256MiB for each test case.

Hint

For all test data,
\(1 \leqslant n \leqslant 10^3\)
\(1 \leqslant l_i \leqslant r_i \leqslant 10^9\)

Problem comes from a team of luogu.

信息

ID
1005
难度
9
分类
(无)
标签
(无)
递交数
1
已通过
1
通过率
100%
上传者