There are candidates in an international innovation contest. Each candidate has a project that requires more funding to reach the finals. The -th candidate (1 \leq i \leq n) currently has m_i dollars of funding and needs an additional p_i dollars to fully realize their project.
You are a philanthropist aiming to support promising candidates and allocate your resources wisely. For each candidate, you can choose one of the following actions:
Provide full sponsorship, claiming their existing funds for broader innovation (i.e., direct their m_i dollars to collective research),
Do nothing,
Help the candidate by providing exactly p_i dollars so their project comes to fruition. In return, you may encourage them to support further collective innovation and ensure mutual benefit in the future (but you cannot claim their funds directly).
You start with no funds of your own. For every project you claim funds from, you must also fully support at least one other candidate (help them reach their funding goals) so as to maintain the trust and transparency of your philanthropic foundation. You cannot claim support from someone you chose to help.
What is the maximum number of projects you can claim initial funding from, under these conditions?
The first line contains a positive integer (1 \leq n \leq 100\,000), the number of candidates.
The second line contains positive integers m_1, m_2, \ldots, m_n (1 \leq m_i \leq 10^9 for all 1 \leq i \leq n).
The third line contains positive integers p_1, p_2, \ldots, p_n (1 \leq p_i \leq 10^9 for all 1 \leq i \leq n).
Output a single non-negative integer, the maximum number of projects from which you can claim funding.
Note that your goal is not to maximize your own resources, but rather the number of candidate projects for which you can claim the initial funds.
Example 1
Example 2
Example 3