import Control.Applicative

main :: IO ()
main = do
  { [a,b,x] <- readLineInputs :: IO [Int]
  ; print $ solve a b x
  }
; 
solve :: Int -> Int -> Int -> Int
solve a b x = let
  { r = a `mod` x
  ; d = b - a + 1 - if r == 0 then 0 else x - r 
  } in if d < 0 then 0 else case divMod d x of
          { (q,0) -> q; (q,_) -> q+1 }

-- I/O

readLineInputs :: Read a => IO [a]
readLineInputs = map read . words <$> getLine
