""" https://yukicoder.me/problems/no/1830 前半と後半で分ける? まず、0項目をAとする ラストがBの場合、最初と最後を除いた区間が答え ラストもAの場合は 真ん中で切る 左右のうち、Bが多いほうを角から二分探索。 A=Bとなる区間を見つける 補集合が答え """ import sys from sys import stdin N = int(stdin.readline()) askdic = {} askdic[N] = N//2 def ask(i,side): if side == "L": if i in askdic: return askdic[i] print ("?",i,flush=True) cat = int(stdin.readline()) askdic[i] = cat return askdic[i] else: askind = N-i if askind in askdic: return N//2 - askdic[askind] print ("?",askind,flush=True) cat = int(stdin.readline()) askdic[askind] = cat return N//2 - askdic[askind] def getAB(rangenum,askans): if l1 == 0: return askans , rangenum - askans else: return rangenum - askans, askans #N = int(stdin.readline()) l1 = ask(1,"L") r1 = ask(1,"R") if l1 != r1: print ("!",2,N-1,flush=True) sys.exit() else: leftA,leftB = getAB(N//2, ask(N//2,"L") ) if leftA <= N//2: l = 1 r = N//2 while r-l != 1: m = (l+r)//2 mA,mB = getAB(m , ask(m,"L") ) if mA <= mB: r = m else: l = m print ("!",r+1,N,flush=True) sys.exit() else: l = 1 r = N//2 while r-l != 1: m = (l+r)//2 mA,mB = getAB(m , ask(m,"R") ) if mA <= mB: r = m else: l = m print ("!",1,N-r,flush=True) sys.exit()