You are given a directed simple graph with vertices and edges.
We say that a vertex can visit a cycle if, starting from and moving along directed edges, it is possible to reach a vertex that belongs to some directed cycle.
Find the number of vertices from which no cycle can be visited.
Input
The input is given in the following format.
The edge represents a directed edge from vertex to vertex .
Output
Print the number of vertices from which no cycle can be visited.
Constraints
- .
- .
- ().
- ().
- No directed edge appears more than once.
Subtasks
Samples
예제 1
입력
4 3
1 2
2 3
3 4
출력
4
There is no cycle in the graph, so no vertex can visit a cycle.
예제 2
입력
6 5
1 2
2 3
3 2
4 1
5 6
출력
2
Vertices and are contained in a cycle. From vertices and , this cycle can be visited.
From vertices and , no cycle can be visited, so the answer is .
예제 3
입력
5 6
1 2
2 3
3 1
3 4
4 5
5 4
출력
0
Every vertex can visit some cycle.