main = do [l, r, m] <- map read . words <$> getLine print $ if r - l + 1 < m then r - l + 1 else m