import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Monad.ST
import Data.List
import Data.Maybe (fromJust)

data Pair = Pair Integer Integer deriving Show


getDivisorPairs :: Integer -> Integer -> [Pair]
getDivisorPairs a b
    | a < b * b = []
    | a `mod` b == 0 = (Pair (a `div` b) b):(getDivisorPairs a (b + 1))
    | otherwise = getDivisorPairs a (b + 1)


getDigitCountPair :: Pair -> Integer
getDigitCountPair (Pair a b) = max (getDigitCount a) (getDigitCount b)


getDigitCount :: Integer -> Integer
getDigitCount 0 = 0
getDigitCount n = 1 + (getDigitCount (n `div` 10))


solve :: Integer -> Integer
solve n = minimum counts
    where
        pairs = getDivisorPairs n 1
        counts = map getDigitCountPair pairs


main :: IO ()
main = do
    n <- fst . fromJust . BS.readInteger <$> BS.getLine
    print $ solve n
