use std::collections::HashSet; fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let mut xx: Vec = xx .split_whitespace() .skip(1) .map(|n| n.parse().unwrap()) .collect(); xx.sort_unstable(); let distances: HashSet = xx.windows(2).map(|x| x[1] - x[0]).collect(); if distances.len() == 1 && !distances.contains(&0) { println!("YES"); } else { println!("NO"); } }