list = gets.split.map(&:to_i) for i in 1..10 do unless list[i - 1] == i puts i break end end