import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines n = int(readline()) m = map(int, read().split()) p = sorted(zip(m, m), key=lambda x: sum(x)) S = 1 for x in p: T = S & (1<