main :: IO () main = do n <- readLn :: IO Int print $ solver n solver :: Int -> Int solver = iter where iter :: Int -> Int iter = (map f [0..10^6] !!) where f 0 = 1 f i = iter (i `div` 3) + iter (i `div` 5)