let ln2 = log 2. let cookie nf = let ln = (log nf) /. ln2 in let f, c = floor ln, ceil ln in let ln0 = if ln -. f < c -. ln then f else c in if abs_float (nf -. 2. ** ln0) < 0.0000000001 then ln else ln +. 1. let () = print_int @@ int_of_float @@ cookie @@ read_float ()