main :: IO ()
main = do
  [a, b, m] <- getInts
  putStrLn . show $ solve a b m


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

solve :: Int -> Int -> Int -> Int
solve a b m = if (bb - aa < 0)
              then 0
              else (bb - aa) `div` m + 1
  where
    aa = head [n | n <- [a..], n `mod` m == 0]
    bb = head [x | x <- [b, b-1..0], x `mod` m == 0]
