We are given a directed graph with $$$n$$$ vertices and $$$m$$$ edges. The vertices of the graph are numbered from $$$1$$$ to $$$n$$$, and each edge leads from a vertex with a smaller number to a vertex with a larger number.
We call a sequence of paths interesting if:
What is the length of the longest interesting sequence of paths?
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq n\leq 10^6$$$, $$$0 \leq m \leq 10^6$$$), denoting the number of vertices and edges of the considered graph.
Each of the next $$$m$$$ lines contains two integers $$$a$$$ and $$$b$$$ ($$$1 \leq a \lt b \leq n$$$) describing a directed edge leading from vertex $$$a$$$ to vertex $$$b$$$. Each pair $$$(a,b)$$$ appears in the input at most once.
The output should contain a single integer - the maximum length of the interesting sequence of paths.
5 7 1 3 3 5 1 2 2 3 3 4 4 5 2 4
4
5 3 1 3 2 3 2 5
0
For the first example, an interesting sequence of paths of length $$$4$$$ may look as follows:
| Name |
|---|


