use std::io; use std::str::FromStr; use std::str::Chars; use std::i32; use std::u8; use std::ascii::AsciiExt; use std::collections::HashMap; use std::collections::HashSet; use std::collections::BTreeMap; use std::collections::BTreeSet; use std::collections::VecDeque; use std::io::prelude::*; fn main() { let n = next_int(); let a = next_ints(); let mut max = i32::MIN as i64; let mut ans = 0; for i in a { if i > max { max = i; } else { ans += 1; } } println!("{}",ans); } #[allow(dead_code)] fn next_string() -> String { let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); input } #[allow(dead_code)] fn next_strings() -> Vec { let input = next_string(); input.split_whitespace().map(|x| x.parse().unwrap()).collect() } #[allow(dead_code)] fn next_int() -> i64 { let input = next_string(); i64::from_str(input.trim()).unwrap() } #[allow(dead_code)] fn next_ints() -> Vec { let input = next_string(); input.split_whitespace().map(|x| x.parse().unwrap()).collect() }