fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let input: Vec = s.trim().split_whitespace().map(|e| e.parse().unwrap()).collect(); let l = input[0]; let r = input[1]; let m = input[2]; let w = r - l + 1; let cnt = if w < m { w } else { m }; println!("{}", cnt); }