use std::cmp::*; use std::collections::HashMap; fn getline() -> String { let mut ret = String::new(); std::io::stdin().read_line(&mut ret).ok(); return ret; } fn parse(s : &str) -> T { match s.parse::() { Ok(t) => t, _ => panic!(), } } fn main() { let n = parse(getline().trim()); let mut hm: HashMap = HashMap::new(); for _ in 0 .. n { let a: String = String::from(getline().trim()); if let Some(x) = hm.clone().get(&a) { hm.insert(a, x + 1); } else { hm.insert(a, 1); } } println!("{}", if hm.values().all(|&x| x <= (n + 1) / 2) { "YES" } else { "NO" }); }