let list_max_min lst = let rec list_max_min_by' lst cur_max cur_min = match lst with | [] -> (cur_max, cur_min) | x::xs -> list_max_min_by' xs (max cur_max x) (min cur_min x) in match lst with | [] -> failwith "list is empty" | [x] -> (x, x) | x::xs -> list_max_min_by' xs x x let solve n a_lst = let max_l, min_l = list_max_min a_lst in if max_l = min_l then ( if max_l / (n - 1) = 2 then (n, 0) else (0, n) ) else let y = ((max_l + 2) - 2 * n) / 2 in (n - y, y) let () = let n = read_line () |> int_of_string and a_lst = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string in solve n a_lst |> fun (t, k) -> Printf.printf "%d %d\n" t k