main :: IO ()
main = do
  is <- map read . words <$> getLine :: IO [Int]
  let   a = head is
        b = is !! 1
        x = last is
  print $ (solve b x) - (solve (a-1) x)


solve :: Int -> Int -> Int
solve n x = if n < 0 then 0 else n `div` x+1
