import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    n <- getInt
    let as = filter ((== 0) . (n `mod`)) $ takeWhile (\k -> k^2 <= n) [1..n]
    print . minimum $ map (\a -> f a (n `div` a)) as

f a b = max (length (show a)) (length (show b))