f a b x = let
    first:_ = filter (\n -> n `mod` x == 0) [a .. a + x]
    last:_ = reverse $ filter (\n -> n `mod` x == 0) [b - x .. b]
    in max 0 $ (last - first) `div` x + 1

main = do
    [a, b, x] <- map read . words <$> getLine
    print $ f a b x
