Inna loves sleeping very much, so she needs n alarm clocks in total to wake up. Let's suppose that Inna's room is a 100 × 100 square with the lower left corner at point (0, 0) and with the upper right corner at point (100, 100). Then the alarm clocks are points with integer coordinates in this square.

The morning has come. All n alarm clocks in Inna's room are ringing, so Inna wants to turn them off. For that Inna has come up with an amusing game:  First Inna chooses a type of segments that she will use throughout the game. The segments can be either vertical or horizontal.  Then Inna makes multiple moves. In a single move, Inna can paint a segment of any length on the plane, she chooses its type at the beginning of the game (either vertical or horizontal), then all alarm clocks that are on this segment switch off. The game ends when all the alarm clocks are switched off. 

Inna is very sleepy, so she wants to get through the alarm clocks as soon as possible. Help her, find the minimum number of moves in the game that she needs to turn off all the alarm clocks!


-----Input-----

The first line of the input contains integer n (1 ≤ n ≤ 10^5) — the number of the alarm clocks. The next n lines describe the clocks: the i-th line contains two integers x_{i}, y_{i} — the coordinates of the i-th alarm clock (0 ≤ x_{i}, y_{i} ≤ 100).

Note that a single point in the room can contain any number of alarm clocks and the alarm clocks can lie on the sides of the square that represents the room.


-----Output-----

In a single line print a single integer — the minimum number of segments Inna will have to draw if she acts optimally.


-----Examples-----
Input
4
0 0
0 1
0 2
1 0

Output
2

Input
4
0 0
0 1
1 0
1 1

Output
2

Input
4
1 1
1 2
2 3
3 3

Output
3



-----Note-----

In the first sample, Inna first chooses type "vertical segments", and then she makes segments with ends at : (0, 0), (0, 2); and, for example, (1, 0), (1, 1). If she paints horizontal segments, she will need at least 3 segments.

In the third sample it is important to note that Inna doesn't have the right to change the type of the segments during the game. That's why she will need 3 horizontal or 3 vertical segments to end the game.

Difficulty: interview

Starter code:

Solutions:
a, b = [0] * 101, [0] * 101
for i in range(int(input())):
    x, y = map(int, input().split())
    a[x] = b[y] = 1
print(min(sum(a), sum(b)))

n = int(input())
useX = [False]*101
useY = [False]*101
cntX = 0
cntY = 0
for i in range(n):
    (x,y) = input().split(" ")
    x = int(x)
    y = int(y)
    cntX += 0 if useX[x] else 1
    cntY += 0 if useY[y] else 1
    useX[x] = True
    useY[y] = True

print(cntX if cntX < cntY else cntY )


l1=[0]*101
l2=[0]*101
n=int(input())
for li in range(n):
    (x,y)=input().split(" ")
    a=int(x)
    b=int(y)
    l1[a]=1
    l2[b]=1
print(min(sum(l1),sum(l2)))


n = int(input())
x = [0] * 101
y = [0] * 101
for _ in range(n):
  i, j = map(int, input().split())
  x[i] = 1
  y[j] = 1
print(min(sum(x), sum(y)))

N=int(input())
Hor=Ver=1

H=[]
V=[]
for I in range(N):
    Tmp=list(map(int,input().split()))
    H+=[Tmp[0]]
    V+=[Tmp[1]]
H.sort()
V.sort()
Tmp1=H[0]
Tmp2=V[0]
for I in range(1,N):
    Hor+=1 if not Tmp1==H[I] else 0
    Ver+=1 if not Tmp2==V[I] else 0
    Tmp1=H[I]
    Tmp2=V[I]
    
print(min(Hor,Ver))


n = int(input())
h = set()
v = set()
for i in range(n):
    a, b = list(map(int, input().split(' ')))
    h.add(a)
    v.add(b)
print(min(len(h), len(v)))


from math import *

n = int(input())
a = set()
b = set()
for i in range(n):
    x,y = map(int,input().split())
    a.add(x)
    b.add(y)
print(min(len(a),len(b)))

n = int(input())
xset = set()
yset = set()
l = list(tuple(map(int, input().split())) for _ in range(n))
for a in l:
    xset.add(a[0])
    yset.add(a[1])
print(min(len(xset), len(yset)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))

no_of_alarms = int(input())

x_set = set()
y_set = set()
while no_of_alarms > 0:
    i_alarm = input().split( )

    x_set.add(int(i_alarm[0]))
    y_set.add(int(i_alarm[1]))

    no_of_alarms = no_of_alarms - 1

if len(x_set) <= len(y_set):
    print(len(x_set))
else:
    print(len(y_set))

ac = int(input())
x = set()
y = set()
if ac>0 and ac<100001:
    for i in range(ac):
        a, b = map(int, input().split(' '))
        if a>=0 and a<=100 and b>=0 and b<=100:
            x.add(a)
            y.add(b)
    if len(x)<len(y):
        print(len(x))
    else:
        print(len(y))

ac = int(input())
x = set()
y = set()
if ac>0 and ac<100001:
    for i in range(ac):
        a, b = map(int, input().split(' '))
        if a>=0 and a<=100 and b>=0 and b<=100:
            x.add(a)
            y.add(b)
    if len(x)<len(y):
        print(len(x))
    else:
        print(len(y))

no_of_alarms = int(input())

x_set = set()
y_set = set()
while no_of_alarms > 0:
    i_alarm = input().split( )

    x_set.add(int(i_alarm[0]))
    y_set.add(int(i_alarm[1]))

    no_of_alarms = no_of_alarms - 1

if len(x_set) <= len(y_set):
    print(len(x_set))
else:
    print(len(y_set))

a = set()
b = set()
clock = int(input())
for i in range(clock):
    c,d = list(map(int,input().split()))
    a.add(c)
    b.add(d)
print(min(len(a),len(b)))


n = int(input())

x_set = set()
y_set = set()

for i in range(n):
	x,y = map(int, input().split())

	x_set.add(x)
	y_set.add(y)

print(min(len(x_set), len(y_set)))

def main():
    n = int(input())
    r = set()
    c = set()
    for i in range(n):
        (x, y) = list(map(int, input().split(' ')))
        r.add(y)
        c.add(x)
    return min(len(r), len(c))

print(main())


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


I=input
a=set()
b=set()
for _ in '0'*int(I()):x,y=I().split();a.add(x);b.add(y)
print(min(len(a),len(b)))


a, b = [0] * 101, [0] * 101
for i in range(int(input())):
    x, y = map(int, input().split())
    a[x] = b[y] = 1
print(min(sum(a), sum(b)))