open System let isKadomatsu (a1, a2, a3) = a1 <> a3 && ((a1 < a2 && a3 < a2) || (a1 > a2 && a3 > a2)) let countKadomatsu (a1, a2, a3) = if isKadomatsu (a1, a2, a3) then -1 else let maxA = [a1; a2; a3] |> List.max seq {2..maxA} |> Seq.map (fun i -> (a1 % i, a2 % i, a3 % i)) |> Seq.filter isKadomatsu |> Seq.length Console.ReadLine () |> (fun line -> line.Split([| ' ' |])) |> Array.map int |> (fun arr -> (arr.[0], arr.[1], arr.[2])) |> countKadomatsu |> (function -1 -> "INF" | n -> string n) |> printfn "%s"