use std::{collections::HashMap, io::Read}; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let s = s.split_whitespace().skip(1); let mut h = HashMap::new(); s.for_each(|o| *h.entry(o).or_insert(0) += 1); println!( "{}", if h.values().all(|&v| v - 1 <= h.values().sum::() - v) { "YES" } else { "NO" } ); }