def solve(incomes)
  avg = incomes.sum / incomes.size
  incomes.select {|n| n <= avg }.size
end

@line_count = 0
while (line = gets.chomp) != '0' do
  if @line_count % 2 == 1 then
    incomes = line.chomp.split(' ').map {|n| n.to_i }
    puts solve incomes
  end
  @line_count += 1
end
