use proconio::input;
use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        aa: [usize; n],
    }

    let mut map = HashMap::new();

    for &a in aa.iter() {
        *map.entry(a).or_insert(0) += 1;
    }

    let has_zero = if let Some(&count) = map.get(&0) {
        if count == n {
            println!("Yes");
            return;
        }
        true
    } else {
        false
    };

    if map.len() == 2 && has_zero {
        let zero = map.remove(&0).unwrap();
        let (_, other) = map.into_iter().next().unwrap();
        if zero == n/3 && other == n * 2 / 3 {
            println!("Yes");
            return;
        }
    } else if map.len() == 3 {
        for (_, count) in map.into_iter() {
            if count != n/3 {
                println!("No");
                return;
            }
        }
        println!("Yes");
        return;
    }

    println!("No");
}
