N = gets.to_i X = gets.split.map(&:to_i).sort d = X[1] - X[0] puts d > 0 && X.each_cons(2).all?{|a,b| a + d == b } ? :YES : :NO