Aizu is a country famous for its rich tourism resources and has N cities, each of which is uniquely identified with a number (0 to N-1). It has a road network consisting of M one-way roads connecting a city to another.
All the roads connecting the cities in Aizu have a row of cherry trees along their routes. For enhancing the cherry-viewing experience, a proposal was made to modify the road network so that a tourist can travel around all the roads. To achieve this target, it was decided to construct several one-way roads, each connecting two cities and abiding by the following rules.
You, as a tourism promotion officer, are assigned with the task of writing a program for the road construction project.
Write a program to determine the minimum number of roads to be constructed given the road network information in Aizu.
The input is given in the following format.
N M s_1 t_1 s_2 t_2 : s_M t_M
The first line provides the number of cities N (1 ≤ N ≤ 104) and roads M (0 ≤ M ≤ 105). Each of the subsequent M lines provides the numbers assigned to start and destination cities for the i-th road: s_i, t_i (0 ≤ s_i, t_i ≤ N-1) , where s_i ≠ t_i. (no duplicate appearance of a road)
Output the minimum number of roads to be newly constructed.
6 7 0 2 2 1 1 0 2 3 4 3 4 5 5 4
2
6 9 0 2 2 1 1 0 2 3 4 3 4 5 5 4 5 2 3 4
0