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 = a + a `mod` m
    bb = b - b `mod` m
