solve :: Integer -> Integer -> Integer -> Integer
solve a b x = (h b x) - (h (a-1) x)
              where h c x = c `div` x

main = do
  [a, b, x] <- map read . words <$> getLine
  putStrLn $ show $ solve a b x
