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