A camera shop has n rectangular lens barrels, each described by a width and a height. Barrel A fits inside barrel B if the width of A is strictly less than the width of B and the height of A is strictly less than the height of B (no rotation is allowed). A nesting chain is a set of barrels that can be ordered so each one fits inside the next. Report the maximum number of barrels in a nesting chain.
Input format
Line 1: an integer n.
Next n lines: two integers w h, the width and height of one barrel.
Output format
A single integer: the maximum number of barrels that can be nested.
Constraints
- 1 <= n <= 100000
- 1 <= w, h <= 1000000000