401684: GYM100513 I Sale in GameStore
Description
A well-known Berland online games store has announced a great sale! Buy any game today, and you can download more games for free! The only constraint is that the total price of the games downloaded for free can't exceed the price of the bought game.
When Polycarp found out about the sale, he remembered that his friends promised him to cover any single purchase in GameStore. They presented their promise as a gift for Polycarp's birthday.
There are n games in GameStore, the price of the i-th game is pi. What is the maximum number of games Polycarp can get today, if his friends agree to cover the expenses for any single purchase in GameStore?
InputThe first line of the input contains a single integer number n (1 ≤ n ≤ 2000) — the number of games in GameStore. The second line contains n integer numbers p1, p2, ..., pn (1 ≤ pi ≤ 105), where pi is the price of the i-th game.
OutputPrint the maximum number of games Polycarp can get today.
ExamplesInput5Output
5 3 1 5 6
3Input
2Output
7 7
2Note
In the first example Polycarp can buy any game of price 5 or 6 and download games of prices 1 and 3 for free. So he can get at most 3 games.
In the second example Polycarp can buy any game and download the other one for free.