Swords | 프로그래밍의 벗 PivotOJ
PivotOJ

Swords

시간 제한: 1000ms메모리 제한: 1024MB출처: NOI 2023 QualificationBOJ 28491

문제

Yan Hao has nn swords numbered from 11 to nn. Sword ii has attack a[i]a[i] and defence b[i]b[i].

Yan Hao thinks that sword ii is useless if there exists a different sword jj (jij \ne i) such that a[i] ≤ a[j] and b[i] ≤ b[j]. That is, a sword ii is useless if the attack and defence of another sword jj are both at least as good as that of sword ii. If a sword is not useless, we say that it is useful.

Two swords are considered equivalent if they have the same attack and same defence. It is guaranteed that no pair of swords are equivalent.

Help Yan Hao find the number of useful swords in his collection.

입력

The first line of input contains exactly 11 integer, nn.

The next nn lines of input contains two space-separated integers each. The ii-th such line of input will contain a[i]a[i] and b[i]b[i] respectively, indicating the attack and defence of sword ii.

출력

The output should contain one integer, the number of useful swords.

예제

예제 1

입력
3
2 3
1 3
5 3
출력
1

예제 2

입력
4
5 6
2 5
6 9
1 3
출력
1
코드를 제출하려면 로그인하세요.