Problem D
Kodama Hierarchy

You are currently trying to recruit a squad of kodama in order to take over the world.
You can pick some subset of
Kodamas operate under a hierarchical system. This means that kodamas are only satisfied in a group if every other kodama in the group is strictly lower or strictly higher in both aura and charisma. In other words, no two kodamas can exist in the group if one kodama has higher aura and the other one has higher charisma, or if they are equal in either stat.
However, kodamas are also social creatures. If any non-empty
subset of the other kodamas from the
Since kodamas are quite chaotic, you want to pick out the least kodamas possible for the group. Find the minimum number of kodamas you can form a valid group with.
Input
The first line contains a single integer
Output
Output one line containing a single integer, representing the minimum size of a valid kodama group that you can form.
Sample Input 1 | Sample Output 1 |
---|---|
5 2 0 0 32 7 10 4 88 5 47 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
6 6 3 13 11 7 10 10 15 9 5 2 5 |
3 |