import Data.List

main = interact $ show . sol . read

sol n | n<=9 = 1
sol n = succ . floor $ log (fromIntegral (m+1)) / log 10
  where
  q = ceiling . sqrt $ fromIntegral n
  ps = fmap ((,) <$> head <*> length) . group $ primeFactors n
  ds = foldr1 ((<*>) . ((*) <$>)) $ fmap (\x -> (fst x^) <$> [0..snd x]) ps
  m = minimum [d | d <- ds, d>=q]

-- | Prime numbers
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