Competition
In a sports tournament, there are N participants, each identified by a unique number from 1 to N. The tournament is conducted in a round-robin format, meaning every participant plays a match against every other participant, with each match resulting in a win for one player. A participant is said to be in position P at the tournament's conclusion if:
They have defeated exactly (P-1) participants, and all other participants have lost to them.
Every participant who has defeated them has also won against all participants they have defeated.
For some participants, it may not be possible to determine their final position based on the matches played.
Write a program, CONTEST, that takes the number N and the results of the matches played so far, and calculates how many participants' final positions cannot be determined, regardless of the outcomes of the remaining matches.
Input
The first line of the input contains two natural numbers: N — the total number of participants in the tournament (1 ≤ N ≤ 100) and M — the number of matches that have already been played. The following M lines each describe a match, with two numbers indicating the winner and the loser of that match.
Output
The output should be a single line containing an integer — the number of participants whose final positions cannot be determined.