N = int(input())

xs = set()
ys = set()
for i in range(N):
    x,y = map(int, input().split())
    xs.add(x)
    ys.add(y)

if len(xs) < 2 * 10**9 and len(ys) < 2 * 10**9:
    print(2)
else:
    print(1)