main :: IO ()                                                                                                              
main = do                                                                                                                  
  [a,b,x] <- map read . words <$> getLine :: IO [Integer]                                                                  
  let c = b - a + 1                                                                                                        
      d = c `div` x                                                                                                        
      e = c `mod` x                                                                                                        
      f = a `mod` x                                                                                                        
      g = if f + e - 1 >= x then 1 else 0                                                                                  
  print $ d + g