use std::collections::HashMap; fn main() { let mut cc = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut cc).ok(); let cc: Vec = cc .split_whitespace() .skip(1) .map(|n| n.parse().unwrap()) .collect(); let mut votes = HashMap::new(); for c in cc { *votes.entry(c).or_insert(0) += 1; } let max = votes.values().max().unwrap(); let answer = votes .iter() .filter(|&(_, v)| v == max) .map(|(k, _)| k) .max() .unwrap(); println!("{:?}", answer); }