sub r{ print"? @_\n"; <>*2-$_[0]; } sub w{ exit!print"! @_\n"; } $|=1; $n=<>; $a=r(1); $a^r($n-1)||w(2,$n-1); $r=$n; (r($m=$l+$r>>1)*$a||w($m*2<$n?($m+1,$n):(1,$m)))>0?$l:$r=$m while 1;