#C380. Minimum Melting Days
Minimum Melting Days
Minimum Melting Days
You are given a list of positive integers representing the heights of candles. Each candle requires a number of days to melt completely. The melting process is such that the melting capacity on any day is equal to the height of the shortest candle in the list plus one additional unit. However, it turns out that the minimum number of days required to melt all the candles is directly equal to the height of the tallest candle. Your task is to write a program that computes the minimum number of days needed to melt all the candles.
Note: Although the narrative mentions a melting process, it can be shown mathematically that the minimum number of days required is given by:
where \( h_i \) is the height of the \( i^{th} \) candle.
inputFormat
The first line contains a single integer \( n \) indicating the number of candles.
The second line contains \( n \) space-separated positive integers representing the heights of the candles.
outputFormat
Output a single integer representing the minimum number of days required to melt all the candles completely.
## sample4
4 3 2 1
4