Boxes
Vasya has numerous boxes scattered throughout his room, and his mom wants him to tidy up. Due to limited space, Vasya plans to stack all the boxes on top of each other.
However, this might not always be feasible. For instance, placing a heavy iron object on a cardboard box filled with Christmas decorations could lead to needing new decorations for the next holiday season.
Vasya has weighed each box and estimated the maximum weight each can support. Your task is to help him find the maximum number of boxes (m) he can stack such that for every box, the total weight of the boxes above it does not exceed its maximum weight capacity.
Input
The first line of the input contains an integer (n) ((1 n 10^5)) — the number of boxes in the room. Each of the following (n) lines contains two integers (w_i) and (c_i) ((1 w_i 10^5), (1 c_i 10^9)), where (w_i) is the weight of the (i)-th box, and (c_i) is the maximum weight it can support.
Output
Output a single integer — the solution to the problem.