Cafe "Proboscis"
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
The new cafe "Proboscis" is opened in the city of Е. for elephants. All clients come to the cafe at the time 0, and the owner chooses the order in which to serve them. Every second only one elephant is served (the first one is served at the time 0).
The owner knows that if the elefant i will be served at the time t, he will pay tips[i]
- t tips. If the number tips[i]
- t is negative, he will pay nothing. Help the owner to find the service order of elephants that will bring him the maximum profit.
Input
The first line contains the number of elephants n (0 ≤ n ≤ 100), arrived to cafe. The next line contains n numbers tips[1]
, tips[2]
, ..., tips[n]
(0 ≤ tips[i]
≤ 10^5
).
Output
Print the maximum profit for cafe owners.
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 40%