num = gets.to_i list = gets.split(" ").map(&:to_i).sort a = list[0] - list[1] for i in 2..num-1 if list[i] - list[i+1] != a || list[i] - list[i+1] == 0 puts "NO" break end if i == num-1 puts "YES" break end end