while input = gets

  if (input.to_i) == 0
    exit
  else
    n = input.to_i
    score = Array.new(n, nil)
    sum = 0
  end

  for roop in 0 .. (n - 1)
    score[roop] = gets.to_i
  end

  for roop in 1 .. (n - 2)
    sum += score[roop]
  end

  puts sum / (n - 2)
end