import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.datetime;

void main()
{
	int n;
	while (n = readln.chomp.to!int, n) {
		auto score = new int[](n);
		foreach (i; 0..n) {
			score[i] = readln.chomp.to!int;
		}
		auto x = score.reduce!("a+b", max, min);
		writeln((x[0]-x[1]-x[2])/(n-2));
	}
}