Description

Giving a collection S of points on two dimension plane. (S = {(x0,y0), (x1,y1), ... }) We define a point is greater than another point when all its coordinate on two axis are both greater than or equel to another one. Namely, p is greater than q when xp >= xq and yp >= yq A sequence is a list points < p1, p2, ... > satisfy that i < j => pi is greater than pj. You can use the elements in S to construct sequences, how many sequences needed to cover a S at least?

Input

The input consists of several test cases. Each test case start with a line containing a number n(0 < n <= 1000000), the number of points in S. Then n lines follows, each line containing two number, xi, yi(0 <= xi, yi < 100000), the position of point i. The input end with EOF.

Output

You have to print minium number of sequences needed to cover S in a single line for each case.

Sample Input

4 1 1 2 2 3 3 4 4 4 1 5 2 6 2 3 3 4

Sample Output

1 2

Source

厦门大学第四届程序设计竞赛 现场决赛 by Loneknight @ btALT