darts.in
darts.out
Vova invited all his friends to his birthday party. After the apple pie had been eaten and juice had been drunk, the children decided to play the Green Darts game. The rules of the game are quite simple:
Si = ai1∙p2 + ai2∙p + ai3,
After the calculation of all Si we can determine the rank Mi of the player i by the formula Mi = Ki + 1, where Ki is the number of players whose the final score is greater than Si.
We can see that several players could have the same rank. Finally, we can form the game result as the vector (M1, M2, …, MN). Two game results are different if the corresponding vectors don't coincide. Vova's friends decide to offer him the choice of the coefficient p. Vova would like to know whether his choice could affect the result of the game. He doesn't know the answer to the following question: how many different results of the game exist, depending on the choice of the coefficient p? Help Vova to solve this hard problem!
The first line of input file contains integer number N. Each of the following N lines contains 3 integer numbers ai1, ai2, ai3, separated by single spaces - the number of points which the 1st, 2nd and 3rd throw brought to player the player i.
The first and only line of the output file should contain the number of different game results.
3 1 99 1 100 100 100 51 49 13
3