Paranoid Cows (paranoid.X) Farmer Ran's N cows (1 <= N <= 100,000) conveniently numberd 1..N are self-conscious about their milk output. A cow who does not produce much milk is likely to be teased by the other cows. FR has designed a milking schedule for the cows in which every cow i is assigned to an interval of time A_i..B_i (0 <= A_i < B_i <= 1,000,000,000). Each cow i must enter the barn at time A_i for milking and depart from the barn at time B_i. The door to the barn is narrow and can accommodate at most one cow at a time, so FJ has designed his schedule so that no two cows enter or leave at the same time. Suppose the milking interval for some cow i contains the interval for some other cow j. That is, A_i < A_j < B_j < B_i. In this case, we say these two intervals "nest". Nesting intervals are bad, since in this case cow i is in the barn for the entire duration of cow j's milking and as a result, cow i can spy on cow j and determine her milk output. Since cows are paranoid about other cows knowing their milk output, FR hopes his schedule does not contain any nested intervals. Help FR by determining the largest index K (1 <= K <= N) such the intervals of cows 1..K have no occurrences of nesting. PROBLEM NAME: paranoid INPUT FORMAT: * Line 1: A single integer: N * Lines 2..N+1: Line i contains two integers: A_i and B_i SAMPLE INPUT: 5 7 20 1 4 3 12 6 10 0 3 OUTPUT FORMAT: * Line 1: A single integer, k. SAMPLE OUTPUT: 3 OUTPUT DETAILS: The interval for cow #4 (6-10), is nested within the interval for cow #3 (3-12). Furthermore, none of the intervals for cows #1..#3 nest within each other.