#GYM104678B. Streamer night
Streamer night
Description
The well-known JoyTube video site is hosting an event called Streamer Night. On this night, which lasts $n$ seconds, every self-respecting channel organizes a stream. You are subscribed to $k$ channels, each of which will start its stream at $a_i$-th second and end it at $b_i$-th second $(i\in[1;k])$. What is the maximum number of streams you can watch that night from start to the end? If any stream ends, then you can switch to another starting stream at the same second.
The first line contains two integers $n$ and $k$ $(2 \leq n \leq 200 000, 1 \leq k \leq 200 000)$. The next $k$ lines contain pairs of numbers $a_i, b_i (1 \leq a_i < b_i \leq n)$.
Print one number - the answer to the problem.
Input
The first line contains two integers $n$ and $k$ $(2 \leq n \leq 200 000, 1 \leq k \leq 200 000)$. The next $k$ lines contain pairs of numbers $a_i, b_i (1 \leq a_i < b_i \leq n)$.
Output
Print one number - the answer to the problem.
5 3
1 3
2 5
3 4
6 4
2 3
2 3
2 3
2 3
2
1