A drone must inspect n patrol segments laid along a straight corridor. Segment i is the closed interval [low, high] (endpoints included). A single scan is fired at one position p and inspects every segment whose range contains p (that is, low <= p <= high). Two segments may be inspected by the same scan if some position lies in both. Report the minimum number of scans needed so that every segment is inspected by at least one scan.
Input format
Line 1: an integer n.
Next n lines: two integers low high (with low <= high).
Output format
A single integer: the minimum number of scans.
Constraints
- 1 ≤ n ≤ 100000
- 0 ≤ low ≤ high ≤ 1000000