let rec range n = if n=0 then [] else n::(range (n-1)) in
let n = read_int () in
  range (int_of_float (sqrt (float_of_int n)))
  |> List.filter (fun i-> (n mod i)=0)
  |> List.map (fun i-> 1+int_of_float (log10 ( float_of_int (max n (n / i)))))
  |> List.fold_left min max_int
  |> print_int