use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let n: Vec = s.split_whitespace().flat_map(str::parse).collect(); let mut d = vec![0; n[0] + 1]; for i in n[2..].chunks(2) { d[i[0] - 1] += 1; d[i[1]] -= 1; let (mut a, mut c) = (0, 0); for d in &d { c += d; if c % 2 == 1 { a += 1 } } println!("{a}") } }