import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); ArrayDeque que = new ArrayDeque<>(); for (int i = 1; i <= N; ++i) que.addLast(i); ArrayList[] loser = new ArrayList[N]; for (int i = 0; i < N; ++i) loser[i] = new ArrayList<>(); while (que.size() > 1) { ArrayDeque next = new ArrayDeque<>(); while (!que.isEmpty()) { if (que.size() >= 2) { int a = que.pop(); int b = que.pop(); System.out.println("? " + a + " " + b); int ans = sc.nextInt(); next.add(ans); loser[ans-1].add((a ^ b) ^ ans); } else if (que.size() == 1) { next.add(que.pop()); } } que = next; } int first = que.pop(); for (int v : loser[first-1]) que.addLast(v); // 2*n-1-n=n-1 while (que.size() > 1) { ArrayDeque next = new ArrayDeque<>(); while (!que.isEmpty()) { if (que.size() >= 2) { System.out.println("? " + que.pop() + " " + que.pop()); int ans = sc.nextInt(); next.add(ans); } else if (que.size() == 1) { next.add(que.pop()); } } que = next; } int second = que.pop(); System.out.println("! " + second); } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }