count = gets.chomp.to_i list = gets.split.map(&:to_i).sort flag = list[1] - list[0] for i in 1...list.size - 1 do distance = list[i + 1] - list[i] if flag != distance flag = 0 break end end puts flag == 0 ? "NO" : "YES"