import Data.List
import System.Environment (getArgs)

-- http://tnomura9.exblog.jp/12332000/
factors :: Integer -> [Integer]
factors n = [x | x <- [1..n], n `mod` x == 0]

factorization :: Integer -> [Integer]
factorization 1 = []
factorization x = v : factorization (x `div` v)
  where v = (factors x) !! 1

factorList n p (x:xs) | (p*x*p*x) >= n = [p] ++ (factorList n p xs)
                      | otherwise = [p*x] ++ (factorList n (p*x) xs)
factorList n p [] = [p]

answer n | n < 10 = 1
         | otherwise = minimum $ map f $ nub $ sort $ factorList n (head l) (drop 1 l)
  where f i = maximum $ map g [i, n `div` i]
        g x = length (show x)
        l = reverse $ sort $ factorization n

main = do
  n <- readLn
  print $ answer (n :: Integer)
