100 atcoder#ABC204B. [ABC204B] Nuts
[ABC204B] Nuts
Score : points
Problem Statement
There are trees. The -th tree bears nuts.
Chipmunk will harvest nuts from the trees in the following manner:
- From a tree with or fewer nuts, she does not take nuts.
- From a tree with more than nuts, she takes all but nuts.
Find the total number of nuts Chipmunk will take from the trees.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3
6 17 28
25
From the three trees, Chipmunk will take , , and nuts, for a total of nuts.
4
8 9 10 11
1