Swords

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

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]a\[i] ≤ a\[j] and b\[i]b\[j]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.

제한

  • 1n100,0001 ≤ n ≤ 100\\,000
  • 1a\[i],b\[i]1091 ≤ a\[i], b\[i] ≤ 10^9
  • For all 1i<jn1 ≤ i < j ≤ n, a\[i]a\[j]a\[i] \ne a\[j] or b\[i]b\[j]b\[i] \ne b\[j]