#graph903. 祭祀
祭祀
Sacrifice
Problem Source
CTSC 2008
Problem Description
In the far east lives a mysterious ethnic group that calls itself the Y tribe. They have lived on the water for generations and worship the Dragon King as their god. On every major festival the Y tribe holds grand sacrifice ceremonies on the water. Their habitat's water system can be viewed as a network of junctions and channels; each channel connects two junctions, and water always flows in a fixed direction along a channel. Clearly, the water system contains no cycles.
Because of their large population, the Y tribe's sacrifices are held simultaneously at multiple junctions. Out of respect for the Dragon King, the choice of these sacrifice sites must be made very carefully. Precisely: the Y tribe believes that if water can flow from one sacrifice site to another, the sacrifice loses its sacred meaning. The tribal chief wants to choose as many sacrifice sites as possible while keeping the ceremonies sacred.
Input Format
The first line contains two space-separated integers , the number of junctions and channels, with junctions numbered through .
Each of the next lines contains two space-separated integers , describing a channel connecting junctions and with water flowing from to .
Output Format
The first line contains one integer : the maximum number of sacrifice sites that can be chosen.
Sample Input
4 4
1 2
3 4
3 2
4 2
Sample Output
2