local function query(num) io.write("? " .. num .. "\n") io.flush() local ret = io.read("*l") ret = tonumber(ret) local a_minus_b = ret - (num - ret) return a_minus_b end local function ans(l, r) io.write("! " .. l .. " " .. r .. "\n") io.flush() os.exit() end local n = io.read("*n", "*l") local left, right = 1, n - 1 local lv = query(left) local rv = query(right) if lv == rv then ans(left + 1, right) end local hn = math.floor(n / 2) for i = 1, 18 do local mid = math.floor((left + right) / 2) local mv = query(mid) if mv == 0 then if hn <= mid then ans(1, mid) else ans(mid, n) end else if mv * lv < 0 then right = mid else left = mid end end end