n = gets.to_i x = gets.split.map(&:to_i).sort if x.uniq.size != x.size puts "NO" else d = x[1] - x[0] a = x[1] 2.upto(n - 1) {|i| a += d if x[i] != a puts "NO" exit end } puts "YES" end