eolymp
bolt
Try our new interface for solving problems
Problems

Cafe "Proboscis"

Cafe "Proboscis"

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 tipsi - t tips. If the number tipsi - 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 (0n100), arrived to cafe. The next line contains n numbers tips1, tips2, ..., tipsn (0tipsi105).

Output

Print the maximum profit for cafe owners.

Time limit 1 second
Memory limit 64 MiB
Input example #1
3
3 2 3
Output example #1
5