Score : 1000 points
We will host a rock-paper-scissors tournament with N people. The participants are called Person 1, Person 2, \ldots, Person N. For any two participants, the result of the match between them is determined in advance. This information is represented by positive integers A_{i,j} ( 1 \leq j < i \leq N ) as follows:
The tournament proceeds as follows:
Find the number of persons with the possibility of becoming the champion.
Input is given from Standard Input in the following format:
N A_{2,1} A_{3,1}A_{3,2} : A_{N,1}\ldotsA_{N,N-1}
Print the number of persons with the possibility of becoming the champion.
3 0 10
2
Person 1 defeats Person 2, Person 2 defeats Person 3 and Person 3 defeats Person 1. If Person 1 and Person 2 play the first match, Person 3 will become the champion. If Person 2 and Person 3 play the first match, Person 1 will become the champion.
6 0 11 111 1111 11001
3