Neo-Robin Hood
There are n aspiring politicians in Neverland. They are wealthy, but not wealthy enough to gain political influence. Since Neverland is a financially transparent haven, we know the bank statements of each politician: the i-th politician (1 ≤ i ≤ n) has m[i]
dollars, and needs p[i]
more dollars to achieve his political goals.
You are the infamous modern superhero Neo-Robin Hood. You earn your living by stealing from the richand wealthy, in order to help... well, whoever promises to help you back. For each of the n politicians you can chose to do one of the following:
Steal his
m[i]
dollars;Do nothing to him;
Help him gain political influence, by giving him
p[i]
dollars.
But your services don’t come for free. Once you help a politician gain political influence, he is bound to help you cover-up one of your thefts so that you won’t get in trouble – for instance, by providing an alibi. In turn, you are also bound to not steal his money in the future.
Initially you start with no money. Your task is to rob as many politicians as possible; however, you can’t afford to get caught, so you need a politician to account for each crime you commit.
What is the maximum number of people you can rob?
Input
The first line contains a positive integer n (1 ≤ n ≤ 100 000), the number of politicians. The second line contains n positive integers m[i]
(1 ≤ m[i]
≤ 10^9
, for all 1 ≤ i ≤ n). The third line contains n positive integers p[i]
(1 ≤ p[i]
≤ 10^9
, for all 1 ≤ i ≤ n).
Output
Output a single non-negative integer, the maximum number of people that you can steal from.
Note that you do not have to maximize your own wealth, but rather the number of people that you arestealing from.