def ave(a)
	a = a.sort
	a.pop
	a.shift
	s = a.size
	mean = 0
	for tmp in a
		mean += tmp
	end
	#puts a,s
	ans = mean / s
	ans
end
n = gets.to_i
while n != 0 
	#a = gets.split.map(&:to_i)
	a = []
	n.times do 
		tmp = gets.to_i
		a.push(tmp)
	end
	
	puts ave(a)
	n = gets.to_i
end