Cow Contest#10151

Cow Contest

1 seconde
128 mégaoctets
Très facile

cows, numbered from to , participate in a programming contest. As we all know, some cows are better at programming than others. Each cow has a fixed skill rating that is unique among all competitors.

The contest consists of several head-to-head rounds, each involving two cows. If cow has a higher skill rating than cow b~(1 \le a, b \le n, a \ne b), then cow will always beat cow .

Farmer John wants to rank the cows by their skill level. Given the results of head-to-head rounds, determine the number of cows whose exact ranks can be uniquely determined from the results. It is guaranteed that the results are consistent and contain no contradictions.

Entrée

The first line contains two integers n~(1 \le n \le 100) and m~(1 \le m \le 4500).

Each of the next lines contains two integers and , describing the result of a single round. The first integer is the winner, meaning that cow defeated cow .

Sortie

Print one integer representing the number of cows whose exact ranks can be uniquely determined from the given results.

Exemples

Exemple 1

Loading
Loading