import Data.Function

f = uncurry $ on max (length . show)

solve n = minimum $ map f $ takeWhile (uncurry (<=)) [(a, b) | a <- [1..], let (b, r) = n `divMod` a, r==0]

main = solve <$> readLn >>= print