solve :: Integer -> Integer -> Integer
solve n x
  | n <= -1 = 0
  | otherwise = n `div` x + 1

main :: IO ()
main = do
  [a, b, x] <- map read . words <$> getLine
  print $ solve b x - solve (a - 1) x