The cows are having a picnic! Each of Farmer John's K cows (1 ≤ K ≤ 100) is grazing in one of N pastures (1 ≤ N ≤ 1,000), conveniently numbered 1 through N. The pastures are connected by M (1 ≤ M ≤ 10,000) one-way paths, and no path connects a pasture to itself.
The cows want to gather in the same pasture for their picnic, but because the paths are one-way, some cows may only be able to reach certain pastures. Determine how many pastures are reachable by every cow, and hence are possible picnic locations.
In the example, the cows can meet in pasture 3 or pasture 4, so there are 2 possible picnic locations.