Alan is planning to adopt a cat!
In front of him is a line of cats. Alan is selecting a cat based on 3 categories: cuteness
, cleanliness
, and coolness
. A cat
is considered an alpha cat if there exists no cat
with
,
, and
. In other words, cat
is alpha if no other cat outperforms cat
in every category.
For example, consider a cat with values and a different cat with values
. The first cat does not outperform the second cat in every category, since their
is equal. Next, consider a cat with values
and a different cat with values
. The first cat outperforms the second cat in every category.
Help Alan find the number of alpha cats!
Input Specification
The first line will contain one integer , the number of cats.
Each of the next lines will contain 3 space-separated integers,
,
, and
.
Output Specification
Output the number of alpha cats.
Sample Input
4
3 3 4
2 2 4
9 1 3
2 2 3
Sample Output
3
Explanation
All cats are alpha cats except for the last cat. The first cat outperforms the last cat in every category.
Comments