main = do n <- read <$> getLine putStrLn $ show $ length $ takeWhile (n>=) $ (*) <$> (iterate ((+1).(*10)) 1) <*> ((*(10^9+1)) <$> [1..9])