Some people think that the bigger an elephant is, the smarter it is. To disprove this, you want to take the data on a collection of elephants and select as large a subset as possible that can be arranged in a sequence so that the weights are strictly increasing while the IQs are strictly decreasing.
The input consists of data for several elephants, one elephant per line, terminated by the end-of-file. The data for a particular elephant is a pair of integers: the first is its weight in kilograms and the second is its IQ in hundredths of an IQ point. Both integers are between 1 and 10000. The data contains information for at most 1000 elephants. Two elephants may have the same weight, the same IQ, or even the same weight and IQ.
Let the weight and IQ of the $i$-th elephant be $W[i]$ and $S[i]$. Consider choosing a subset of elephants that can be ordered as $a[1], a[2], \ldots, a[n]$ so that
$$W[a[1]] < W[a[2]] < \cdots < W[a[n]]$$
and
$$S[a[1]] > S[a[2]] > \cdots > S[a[n]]$$
All inequalities are strict: the weights must be strictly increasing and the IQs must be strictly decreasing. Output a single line containing the maximum possible number of elephants $n$ in such a subset.