import sys import io, os input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n = int(input()) VT = [] for i in range(n): v, t = map(int, input().split()) VT.append((v,t)) VT.sort(key=lambda x: x[0]+x[1]) dp = 1 limit = (1<<30000)-1 for v, t in VT: mask = (1<>i) & 1: print(i) exit()