IntermediateRating 1200
How Far Can News Spread?
News starts at person 1 and travels along one-way links 'u v' (u tells v). Count how many people eventually hear it, including person 1.
Input
n and m; then m lines 'u v'.
Output
One integer.
Sample 1
Input
4 3 1 2 2 3 4 1
Output
3
Sample 2
Input
3 0
Output
1
Output appears here