import Data.List

main = interact $ show . sol . read

sol n = succ . floor $ log (fromIntegral (m+1)) / log 10
  where
  q = ceiling . sqrt $ fromIntegral n
  pfs = primeFactors n
  m = minimum [product ds | ds <- subsequences pfs, product ds>q]

primes :: Integral a => [a]
primes = 2 : filter ((==1) . length . primeFactors) [3,5..]

primeFactors :: Integral a => a -> [a]
primeFactors 1 = []
primeFactors n = factor n primes

factor :: Integral a => a -> [a] -> [a]
factor n (p:ps) 
  | p*p > n        = [n]
  | n `mod` p == 0 = p : factor (n `div` p) (p:ps)
  | otherwise      = factor n ps
