#K47637. Maximum Sum After Removal

    ID: 28243 Type: Default 1000ms 256MiB

Maximum Sum After Removal

Maximum Sum After Removal

You are given an array of n integers. Your task is to remove exactly one element from the array to achieve the maximum possible sum of the remaining elements.

The optimal strategy is to remove the smallest element from the array. In mathematical terms, if the array is \(a_1, a_2, \dots, a_n\) and \(S = \sum_{i=1}^{n} a_i\), then the answer is given by:

\(S - \min(a_1, a_2, \dots, a_n)\)

Read the input from stdin and output the result to stdout.

inputFormat

The first line contains a single integer n representing the number of elements in the array.

The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single integer which is the maximum possible sum of the array after removing exactly one element.

## sample
5
1 2 3 4 5
14

</p>