import qualified Data.Map as M
type Primes = M.Map Integer Integer
type Dim = [Integer]
type Coord = [Integer]
type Base = [Integer]
type Index = Integer

main :: IO ()
main = do
    n <- readLn
    print $ solve n

solve :: Integer -> Int
solve n = minimum $ map f as
    where
        f a = max (length $ show a) (length $ show $ n `div` a)
        as = map (eval dim base) [1 .. m]
        ps0 = primes n
        dim = map (+1) $ M.elems ps0
        base = M.keys ps0
        m = product dim

eval :: Dim -> Base -> Index -> Integer
eval dim base i = product $ zipWith (^) base coord
    where coord = index2coord dim i

index2coord :: Dim -> Index -> Coord
index2coord dim i = tail . map snd $ scanl f (i,0) dim
    where f (a,_) x = (a `div` x, a `mod` x)

primes :: Integer -> Primes
primes 1 = M.empty
primes n = M.unionWith (+) p1 (primes n')
    where
        v = factor1 n
        p1 = M.singleton v 1
        n' = n `div` v

factor1 :: Integer -> Integer
factor1 n = head ks
    where ks = [x | x <- 2:[3,5..], n `mod` x == 0]
