There is an array of length . Initially, for every .
You are also given a permutation of and queries. Query is described by three integers . When it is executed, is replaced by for every .
You must execute every one of the queries exactly once. You may choose their execution order arbitrarily.
Maximize the number of positions satisfying after all queries have been executed.
The input is given from Standard Input in the following format:
For each test case, print one integer: the maximum possible number of positions satisfying after all queries have been executed.
In the first test case, whichever of the two queries is executed later overwrites the whole array, so at most one position can match the target permutation.
In the second test case, all three positions can be made correct by choosing a suitable order.
Each case is given in the following format:
| 2 | 65 | No additional constraints. |