STDOUT.sync = true N = gets.to_i (N / 2).times do |i| x = i + 1 y = N - i puts "? #{x} #{y}" z = gets.to_i if z == x puts y exit elsif z == y puts x exit end end puts (N + 1) / 2