Swords
문제
Yan Hao has swords numbered from to . Sword has attack and defence .
Yan Hao thinks that sword is useless if there exists a different sword () such that a[i] ≤ a[j] and b[i] ≤ b[j]. That is, a sword is useless if the attack and defence of another sword are both at least as good as that of sword . 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 integer, .
The next lines of input contains two space-separated integers each. The -th such line of input will contain and respectively, indicating the attack and defence of sword .
출력
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