main = do
  li <- getLine
  let n = read li
  let ans = compute n
  print ans

compute :: Int -> Int
compute n = minimum
    [ f k p
    | k <- takeWhile (\k -> k*k <= n) [1..]
    , let (p,q) = divMod n k
    , q == 0 ]

ketas = iterate (10 *) 1
keta n = length $ takeWhile (n >) ketas

f a b = max (keta a) (keta b)
