package contest190705; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class E3 { static Scanner in; static PrintWriter out; static String INPUT = ""; static int stronger(int x, int y) { out.println("? " + x + " " + y); out.flush(); return ni(); } static void solve() { int n = ni(); int[] can = new int[n]; for(int i = 0;i < n;i++)can[i] = i+1; int[][] hist = new int[334][]; int q = 0; while(can.length > 1) { int[] ncan = new int[can.length]; int p = 0; for(int i = 0;i < can.length;i+=2) { if(i+1 < can.length) { int res = stronger(can[i], can[i+1]); hist[q++] = new int[] {can[i], can[i+1], res}; ncan[p++] = res; }else { ncan[p++] = can[i]; } } can = Arrays.copyOf(ncan, p); } int[] xcan = new int[n]; int u = 0; for(int i = 0;i < q;i++) { if(hist[i][0] == can[0] || hist[i][1] == can[0]) { xcan[u++] = hist[i][0]^hist[i][1]^hist[i][2]; } } xcan = Arrays.copyOf(xcan, u); while(xcan.length > 1) { int[] ncan = new int[xcan.length]; int p = 0; for(int i = 0;i < xcan.length;i+=2) { if(i+1 < xcan.length) { int res = stronger(xcan[i], xcan[i+1]); ncan[p++] = res; }else { ncan[p++] = xcan[i]; } } xcan = Arrays.copyOf(ncan, p); } out.println("! " + xcan[0]); out.flush(); } public static int[] shuffle(int n, Random gen){ int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = i; for(int i = 0;i < n;i++){ int ind = gen.nextInt(n-i)+i; int d = a[i]; a[i] = a[ind]; a[ind] = d; } return a; } public static void main(String[] args) throws Exception { in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT); out = new PrintWriter(System.out); solve(); out.flush(); } static int ni() { return Integer.parseInt(in.next()); } static long nl() { return Long.parseLong(in.next()); } static double nd() { return Double.parseDouble(in.next()); } static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }