Peanut lives in a city with N towns, numbered from 0 to N-1. There are T important trips that need to be made on a daily basis, with the ith trip being an important person requiring travel from town Ai to town Bi. Peanut wants to build teleporters such that all these trips can be accomplished instantaneously. Each teleporter can teleport people from a single town to another, unidirectionally. This means that if a teleporter were to be built to transport people from town a to town b, then another teleporter needs to be constructed to teleport people from town b to town a if backward instantaneous transport was required.
Help Peanut figure out the minimum number of teleporters that he needs to build.
The first line of input will contain two integers, N and T. The next T lines of input will contain two integers each, containing Ai and Bi for each trip.
The output should contain one line with one integer, the minimum number of teleporters Peanut has to build.
For all subtasks: (Ai, Bi) will be unique, Ai ≠ Bi.
Subtask 1 (32%): 1 ≤ N, T ≤ 1000.
Subtask 2 (31%): 1 ≤ N, T ≤ 200000, the graph formed by the edges (Ai, Bi) will contain no cycles.
Subtask 3 (37%): 1 ≤ N, T ≤ 200000.
Subtask 4 (0%): Sample Testcases.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2