Scanf.scanf "%d" (fun n ->
    let calc count =
        let rec loop rest i =
            if rest < i then i - 1 else
                loop (rest - i) (i + 1)
        in
        loop count 1
    in
    let rec loop r i acc =
        if r = 1 then acc else
        if i * i > n then acc + 1 else
            if r mod i <> 0 then loop r (i + 1) acc else
                let rec loop2 r count =
                    if r mod i = 0 then loop2 (r / i) (count + 1) else
                        loop r (i + 1) (acc + calc count)
                in
                loop2 r 0
    in
    Printf.printf "%d\n" @@
        if n = 1 then 0 else loop n 2 0
)