import Control.Monad
import Data.Maybe (fromJust)
import Data.List
import Data.Char

solve :: Integer -> Integer -> Integer -> Integer
solve a b x = ans
    where
        a1 = (a `div` x) * x
        a2 = if (a `mod` x) == 0 then a1 else a1 + 1
        b1 = (b `div` x) * x
        ans = ((b1 - a2) `div` x) + 1

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