inp = [int(n) for n in input().split()]
n = inp[0]
T = inp[1::2]
D = inp[2::2]
Q = []



for i in range(len(T)):
    Q.append(T[i]*sum(D)/(max(T)*D[i]))

# print(n,T,D,Q)

xr = list(range(1,n+1))
xr.reverse()

def possible():
    durations = 0
    for i in range(len(D)):
        durations = durations + D[i]
        if T[i] < durations:
            return False
    return True

def start():
    if possible():
        return n
    u = 1
    for q in xr:
        T.pop(Q.index(min(Q)))
        D.pop(Q.index(min(Q)))
        Q.pop(Q.index(min(Q)))
        # print(T,D)
        if possible():
            return n - u;
        u = u + 1
            
        
print(start())
