AT_abc454_c [ABC454C] Straw Millionaire
Description
There are $ N $ types of items item $ 1 $ through item $ N $ . Initially, Takahashi has only item $ 1 $ .
He has $ M $ friends. If he gives item $ A_i $ to the $ i $ -th friend $ (1\le i\le M) $ , he will receive item $ B_i $ .
Find how many types of items he can obtain, including item $ 1 $ .
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ M $ $ A_1 $ $ B_1 $ $ A_2 $ $ B_2 $ $ \vdots $ $ A_M $ $ B_M $
Output Format
Output the answer.
Explanation/Hint
### Sample Explanation 1
For example, Takahashi can obtain item $ 4 $ by acting as follows:
- Give item $ 1 $ to the first friend. Receive item $ 2 $ .
- Give item $ 2 $ to the fourth friend. Receive item $ 4 $ .
He can obtain four types of items: items $ 1,2,3,4 $ . Thus, output $ 4 $ .
### Sample Explanation 2
He can obtain one type of item: item $ 1 $ .
### Constraints
- $ 2\le N\le 3\times 10^5 $
- $ 1\le M\le 3\times 10^5 $
- $ 1\le A_i,B_i\le N $
- $ A_i \neq B_i $
- All input values are integers.