n = gets.to_i c = gets.split.map{|t| t.to_i} sum = c.inject(0){|s,i| s+i} sum = sum/10 ans = 0 for t in c do if t <= sum ans = ans + 30 end end p ans