Problem C
Outlets

Fortunately you have some power cords. The $i$-th cord can power $a_ i$ devices (including other power cords).
You want to know how many lasers can be recharged simultaneously.
Input
The first line of input contains an integer $N$ ($1 \le N \le 10\, 000$) containing the number of power cords.
Each of the next $N$ lines contain a single integer containing the number of devices a particular cord can power. $0 \le a_ i \le 1\, 000$.
Output
Output a single integer with the maximum number of lasers you can recharge at the same time. Note that you don’t need to use all the power cords.
Sample Input 1 | Sample Output 1 |
---|---|
1 10 |
10 |
Sample Input 2 | Sample Output 2 |
---|---|
3 5 6 7 |
16 |