use std::collections::HashMap; use proconio::input; fn main() { input! { n:usize, r:[(usize,usize);n], } let mut comp = HashMap::new(); let mut vals = vec![]; for i in 0..n { vals.push(r[i].0); vals.push(r[i].1); } vals.sort(); vals.dedup(); for (i, &val) in vals.iter().enumerate() { comp.insert(val, i); } let mut imos = vec![0; 2 * n]; for i in 0..n { imos[comp[&r[i].0]] += 1; imos[comp[&r[i].1]] -= 1; } let mut ans = imos[0]; for i in 1..2 * n { imos[i] += imos[i - 1]; ans = ans.max(imos[i]); } ans -= 1; println!("{}", ans); }