use std::io::{self, BufRead}; fn get_lines() -> Vec { let stdin = io::stdin(); let lines: Vec = stdin.lock().lines().map(|l| l.unwrap()).collect(); return lines; } fn main(){ let s = &get_lines(); let mut c = 1; for x in s[1].split(' ').map(|x| x.parse::().unwrap()) { if x != c { println!("{}", x - 1); return; } c += 1; } println!("0"); }