Given a set of n intervals [a, b], a set of points S covers the set of intervals if every interval contains at least one of the points in S. An interval [a,b] contains the point p if a ≤ p ≤ b. You must find the smallest possible size of S.
Input Format
The first line of the input will contain a single integer n: the number of intervalsThe following n lines will each specify an interval. They will contain two space separated integers a b: the endpoints of the interval.
Sample Input
1
1 10
Output Format Output a single integer: the minimum number of points needed to cover all the intervals.
Sample Output
1
You must be logged in to submit a solution.