module Main where

    import Debug.Trace

    solve :: Int -> Int -> Int -> Int
    solve a b n = iter a where
        iter x
            | x > b = 0
            | mod n x == 0 = 1 + iter (x+1)
            | otherwise = iter (x+1)

    readLine:: IO [Int]
    readLine = fmap (map read . words) getLine
    
    main :: IO() 
    main = do
        [a, b, n]    <- readLine
        let ans = solve a b n
        print ans
    
