The Bale Tower Always bored with cud-chewing, the cows have invented a new game. One cow retrieves from the shed a set of N (1 <= N <= 50,000) hay bales each of which is one unit high. A second cow tries to choose a set of bales to make the tallest stack of bales in which each bale can be placed only on a bale whose own width and breadth are smaller than the width and breadth of the bale below. Bales can not be rotated to interchange the width and breadth. Help the cows determine the highest achievable tower that can be legally built from a set of bales. PROBLEM NAME: btwr INPUT FORMAT: * Line 1: A single integer: N. * Lines 2..N+1: Each line describes a bale with two space-separated integers: its width and breadth. These dimensions will be in the range 1..100,000,000. SAMPLE INPUT: 6 6 9 10 12 9 11 8 10 7 8 5 3 INPUT DETAILS: Six bales of various widths and breadths. OUTPUT FORMAT: * Line 1: The height of the tallest possible tower that can legally be built from the bales. SAMPLE OUTPUT: 5 OUTPUT DETAILS: These bales can be stacked for a total height of 5: 10 12 9 11 8 10 6 9 5 3 [Another stacking exists, too.]