main = interact $ show . solve . map (read :: String -> Int) . words solve (l:r:m:_) = min (r-l+1) m