ICPC Score Totalizer Software

No attempts yetTime limit1sMemory limit128 MB

Problem

The International Clown and Pierrot Competition (ICPC) is one of the most distinguished and most popular events in show business.

One unique feature of this contest is the large number of judges, which sometimes reaches one hundred. The number of judges may differ from one contestant to another, because any judge who has a relationship of any kind with a particular contestant is temporarily excluded from scoring that contestant's performance.

Basically, the scores given to a contestant's performance by the judges are averaged to decide the contestant's score. To keep judges with eccentric viewpoints from having too much influence, the single highest score and the single lowest score are set aside before the average is computed. If the same highest score is marked by two or more judges, only one of them is ignored; the same rule applies to the lowest score. The average, which may contain a fractional part, is truncated down to an integer to obtain the final score.

Write a program that computes each performance's score from the scores given by all of its judges, so the event can be sped up to fit a TV program.

Input

The input consists of several datasets, each describing one contestant's performance. There are at most 20 datasets.

Each dataset begins with a line containing an integer $n$, the number of judges who scored the performance ($3 \le n \le 100$). Each of the following $n$ lines contains one integer score $s$ ($0 \le s \le 1000$) given by a judge. The input contains no characters other than the digits of these numbers.

The end of the input is indicated by a line containing a single zero.

Output

For each dataset, output a single line containing one decimal integer: the score of the corresponding performance. No other characters may appear on the output line.