b = gets.split.map(&:to_i) a = (1..10).to_a p (a.select { |v| b.count(v) == 0 })[0]