N=gets.to_i C=gets.split.map(&:to_i) d=0 line=C.inject(&:+)/10 C.each{|n| d=d+1 if n <= line} puts d*30