- Time limit: 1.00 s
- Memory limit: 512 MB
There are n cities and m flight routes. Uolevi wants to open one or more shops so that it is not possible to move from any shop to another shop using the flights. Each city may have at most one shop.
What is the maximum number of shops Uolevi can open?
Input
The first line contains two integers n and m: the number of cities and the number of flights. The cities are numbered 1,2,\ldots,n.
Then, there are m lines that describe the flights. Each line contains two values a and b: there is a flight from city a to city b.
Output
Output one integer: the maximum number of shops.
Constraints
- 1 \le n \le 500
- 1 \le m \le 10^5
Example
Input:
4 5 1 4 2 1 2 3 3 2 4 2
Output:
1