use std::collections::HashMap; fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let xx: Vec<&str> = xx.split_whitespace().skip(1).collect(); let mut counts = HashMap::new(); for x in &xx { *counts.entry(x).or_insert(0) += 1; } if *counts.values().max().unwrap() <= (xx.len() + 1) / 2 { println!("YES"); } else { println!("NO"); } }