use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut s = s.split_whitespace().flat_map(str::parse::); let n = s.next().unwrap(); let mut v: Vec<_> = (1..=n).rev().collect(); s.skip(1).for_each(|a| { let i = v.remove(n - a); v.push(i) }); println!("{}", v.last().unwrap()); }