let solve n c_lst = let c_sum = List.fold_left (fun s c -> s + c) 0 c_lst in let th = c_sum / 10 in let rec solve' lst result = match lst with | [] -> result | x::xs -> let result = if x <= th then result + 1 else result in solve' xs result in solve' c_lst 0 |> fun r -> r * 30 let () = let n = read_line () |> int_of_string and c_lst = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string in solve n c_lst |> string_of_int |> print_endline