use std::io::*; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut a: Vec = itr.map(|e| e.parse().unwrap()).collect(); a.reverse(); let mut ans: usize = n; for i in a { if i == ans { ans -= 1; } } println!("{}", ans); }