A long time ago in a galaxy far-far away, 'Marshall Civilization' had made a great progress. The newly founded state of 'newland' had a very different type of road-distribution connecting cities. Roads were only one-way and there was at the most one outgoing road from a city. Now Harsh, the governor of the state, wanted to add minimum number of roads (one-way) such that it becomes possible to reach any city starting from any other city. So, he asked
Sunit, his favourite minister, to perform the task. Since Sunit is very busy, he wants you to help.
[Note that after addition of new roads there can be more than one out-going road from a city]
There will be only one test case per file.
First line of input will contain numbers n and m where n represents the number of cities(n<1000000).
Cities are numbered from 1 to n. This is followed by m lines. Each of the m lines will have two numbers x and y meaning that there is a one-way road from x to y.
0<= n,m< =10^6
Output the minimum number of roads which will be required to be added.