numbers=gets.chomp.split.map {|x| x.to_i} def hakake(nums) return 1 if nums[0] != 1 ret = 10 for x in 0..(nums.length-1) if x > 0 and nums[x] != nums[x-1] + 1 ret = nums[x] - 1 break end end return ret end puts hakake(numbers)