Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/hakamlar-bahosi

Judges' scores

Easy 1000 ms 64 MB 21%
Share

An athlete's performance was scored by $n$ judges. To be fair, one highest and one lowest score are discarded (even if several scores are equal to the highest, only one of them is discarded). Find the sum of the remaining scores.

Judges' scores as bars; the highest and the lowest are crossed out, the rest are added up

Input

The first line contains a positive integer $n$.
The second line contains $n$ integers — the scores.

Output

One integer — the sum.

Note

$3 \le n \le 100$
each score is from $0$ to $100$

Examples

Input #1
5
7 9 6 10 8
Output #1
24
Input #2
3
5 5 5
Output #2
5

Sign in to submit a solution

Signing up is free and takes a minute.