fn main() { let n = read::(); let a = read_vec::(); let mut a = a .iter() .enumerate() .map(|(i, &x)| (x, i)) .collect::>(); a.sort(); let mut used = vec![false; n]; let mut ans = 0; for (_, i) in a { if i < n - 1 && used[i + 1] { continue; } used[i] = true; ans += 1; } println!("{}", ans); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }