main = do [l, r, m] <- map read . words <$> getLine print $ min m (r - l + 1)