Piano Competition
InterviewTime limit2sMemory limit1024 MB
Given N distinct judge scores, output the sum of all scores except the highest and the lowest.
- Level
Easy2 of 10
- Topics
- Array, Implementation, Sorting
- Solved
- No attempts yet
Problem
Choyeoreum, who loves music, entered a competition that tests piano performance.
At the competition, N judges scored Choyeoreum's performance. The i-th judge (1 ≦ i ≦ N) gave Ai points. All of A1, A2, ..., AN are distinct. In this competition, Choyeoreum's total score is the sum of the scores of the N-2 judges other than the judges who gave the highest and lowest scores.
Given the scores from the N judges, write a program to find Choyeoreum's total score.
Input
The input is given from standard input in the following format.
N
A1 A2 … AN
Output
Print Choyeoreum's total score to standard output on 1 line.
Constraints
3 ≦ N ≦ 50.0 ≦ Ai ≦ 100(1 ≦ i ≦ N).Ai ≠ Aj(1 ≦ i < j ≦ N).- All input values are integers.