Every cow's dream is to become the mostpopular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you aregiven up to M (1 <= M <= 50,000) ordered pairs of the form (A, B) thattell you that cow A thinks that cow B is popular. Since popularity is transitive,if A thinks B is popular and B thinks C is popular, then A will also think thatC is
popular, even if this is not explicitlyspecified by an ordered pair in the input. Your task is to compute the numberof cows that are considered popular by every other cow.
Input
Line 1: Two space-separated integers, Nand M
Lines 2..1+M: Two space-separated numbersA and B, meaning that A thinks B is popular.
Output
output
Line 1: A single integer that is thenumber of cows who are considered popular by every other cow.
Comments | NOTHING