import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [a,b,x] <- getIntList
    let b' = b `div` x
        (a',m) = a `divMod` x
    print $ b' - a' + if m == 0 then 1 else 0