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()-1).collect(); let mut b = (0..n).map(|i| (a[i], i)).collect::>(); b.sort(); let mut used = vec![false; n]; let mut result = 0usize; for &(_, i) in b.iter() { if i == n-1 || !used[i+1] { used[i] = true; result += 1; } } println!("{}", result); }