7508: [CSES Problem Set] Movie Festival
[Creator : ]
Description
In a movie festival $n$ movies will be shown.
You know the starting and ending time of each movie.
What is the maximum number of movies you can watch entirely?
You know the starting and ending time of each movie.
What is the maximum number of movies you can watch entirely?
Input
The first input line has an integer $n$: the number of movies.
After this, there are $n$ lines that describe the movies. Each line has two integers $a$ and $b$: the starting and ending times of a movie.
After this, there are $n$ lines that describe the movies. Each line has two integers $a$ and $b$: the starting and ending times of a movie.
Output
Print one integer: the maximum number of movies.
Constraints
$1 \leq n \leq 2 \times 10^5$
$1 \leq a < b \leq 10^9$
$1 \leq a < b \leq 10^9$
Sample 1 Input
3
3 5
4 9
5 8
Sample 1 Output
2