I. A Rainy Delivery
time limit per test
5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

As a Valentine's Day surprise, you want to deliver chocolate to all of your friends. You have $$$N$$$ friends, each living in their own house labeled from $$$1$$$ to $$$N$$$. There are a series of $$$M$$$ one-way roads which connect houses together.

Unfortunately, it is storming heavily outside, so you resort to driving on the one-way roads instead of walking. Assuming you can start at any friend's house and can traverse through roads/houses more than once, what is the maximum number of unique friends you can deliver chocolate to?

Input

The first line of input contains the integers $$$N$$$ and $$$M (1 \leq N \leq 10^3, 1 \leq M \leq 2N)$$$.

The next $$$M$$$ lines contain two integers $$$A$$$ and $$$B$$$, indicating that there is a one-way road pointing from house $$$A$$$ to house $$$B$$$. $$$(A \neq B, 1 \leq A, B \leq N)$$$

Output

Please output an integer $$$K$$$, the maximum number of houses you can visit.

Examples
Input
3 2
1 2
2 3
Output
3
Input
3 1
1 2
Output
2
Input
5 5
3 5
3 2
2 3
4 5
5 1
Output
4