main = getLine >>= print . solve . map read . words

solve :: [Int] -> Int
solve [a, b, x] = (b' - a') `div` x + 1
    where
        a'
            | m == 0 = a
            | otherwise = x * (r + 1)
            where
                (r, m) = a `divMod` x
        b' = x * (b `div` x)
