main = getLine >> getLine >>= print . solve . map read . words solve :: [Int] -> Int solve xs = 30 * foldl (\acc x -> if fromIntegral x <= b then acc + 1 else acc) 0 xs where b = fromIntegral (sum xs) / 10.0