let inf = 10101010101010
let digs x = x |> string_of_int |> String.length
let x = Scanf.scanf "%d" (fun x -> x)
let () =
  Array.init 101010 (fun i ->
    if i > 0 && x mod i = 0 then max (digs i) (digs (x / i))
    else inf)
  |> Array.fold_left min inf
  |> Printf.printf "%d\n"
