use std::{collections::HashMap, io::Read}; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut p = s.split_whitespace(); let n: usize = p.next().unwrap().parse().unwrap(); let mut h = HashMap::new(); let mut i = 0; for p in p.rev() { i += 1; let c = h.entry(p).or_insert(0); if i < n { *h.entry(p).or_insert(0) += 1; continue; } *c -= 1; if *c < 0 { println!("{}", p); break; } } }