CSES - Movie Festival
  • Time limit: 1.00 s
  • Memory limit: 512 MB

In a movie festival nn 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?

Input

The first input line has an integer nn: the number of movies.

After this, there are nn lines that describe the movies. Each line has two integers aa and bb: the starting and ending times of a movie.

Output

Print one integer: the maximum number of movies.

Constraints

  • 1n21051 \le n \le 2 \cdot 10^5
  • 1a<b1091 \le a < b \le 10^9

Example

Input:

3
3 5
4 9
5 8

Output:

2