n = gets.to_i cs = gets.split(' ').map(&:to_i) threshold = cs.inject(&:+) / 10 puts cs.select{|c|c <= threshold}.size * 30