fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: isize = n.trim().parse().unwrap(); let mut lower = 1isize; let mut upper = n-1; println!("? {}", lower); let mut sl = String::new(); std::io::stdin().read_line(&mut sl).ok(); let sl: isize = sl.trim().parse().unwrap(); let sl = 2*sl - lower; println!("? {}", upper); let mut sr = String::new(); std::io::stdin().read_line(&mut sr).ok(); let sr: isize = sr.trim().parse().unwrap(); let sr = 2*sr - upper; if sl == sr { println!("! {} {}", 2, n-1); return; } while upper > lower { let middle = (upper + lower) / 2; println!("? {}", middle); let mut temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp: isize = temp.trim().parse().unwrap(); let temp = temp*2 - middle; if temp == 0 { upper = middle; lower = middle; break; } if temp * sl < 0 { upper = middle; } else { lower = middle+1; } } if lower >= n/2 { println!("! {} {}", 1, lower); } else { println!("! {} {}", lower+1, n); } }