#5. Team Selection

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: syzoj

题目描述

YHZ has n teams for selection. Each team has three attributes.

A team can be selected to the competition if and only if there is no other teams that can beat it in all three attributes.

输入格式

The input contains a single test case.

The first line, a number n , the number of teams.

The following n lines, each line contains three numbers, indicating the attributes of each team.

输出格式

Output the maximum teams YHZ can select for the competition.

样例

Sample Input

3
1 2 3
2 3 1
3 1 2

Sample Output

3

Sample Input 2

4
1 1 3
2 2 4
3 3 1
4 4 2

Sample Output 2

2

数据范围与提示

1 \leq n \leq 3 \cdot 10^5

We guarantee the value of each attribute is a permutation of 1 - n .