gets xs = gets.chomp.split.map(&:to_i).sort distances = [] xs.each_cons(2) {|left, right| distances << right - left } puts (distances.uniq.size <= 1 and distances[0] != 0) ? "YES" : "NO"