A TV channel is airing a movie marathon tonight. The schedule lists movies, and for each movie the time it starts and the time it ends. You want to watch as many movies as possible, but only whole movies - no skipping parts, no watching two at once.
The moment one movie ends, you are free to start another one (a movie that starts exactly when the previous one ends is fine).
Formally, given intervals, find the largest number of them that can be chosen so that no two chosen intervals overlap.
Input
First line of input will be a single number , the number of movies.
In the next lines will be two numbers and , the start and end time of each movie.
Output
A single number - the largest number of whole movies you can watch.
Example
4 1 3 2 5 4 7 6 9
2
You watch the movie , skip (it already started while you were watching), watch , and skip . Two movies.
Constraints