e-olymp
Competitions

Quick Start C: Loops, Arrays, Functions

Sum without maximum

Given array of n integers. Find the sum of all array elements, not equal to maximal.

Input

First line contains number n (n100). Next line contains n integers, each of them does not exceed 100 by absolute value.

Output

Print the sum of all array elements, not equal to maximal.

Time limit 1 second
Memory limit 128 MiB
Input example #1
6
5 9 3 4 6 9
Output example #1
18