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