module Main where

import Data.Functor

main :: IO ()
main = do
  { [a,b,c] <- getInts
  ; print (sum [ 1 ] x <- [a .. b], mod c x == 1])
  )

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

done :: IO ()
done = return ()