#include <bits/stdc++.h>
using namespace std;
int n, a[5005], b[5005], ans[5005], s, q[10005], x[10005];
map<int, int> m;
void ask(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) ask(i, 0), scanf("%d", a + i), x[a[i]] = i;
  for (int i = 0; i < n; i++) ask(x[0], i), scanf("%d", b + i);
  for (int i = 0; i < n; i++) {
    memset(q, -1, sizeof(q));
    for (int j = 0; j < n; j++) q[a[j] ^ i] = j;
    bool ok = 1;
    for (int j = 0; j < n; j++)
      if (q[j] != (b[j] ^ i)) ok = 0, j = n;
    if (ok) ans[++s] = i;
  }
  printf("!\n");
  printf("%d\n", s);
  s = ans[1];
  for (int i = 0; i < n - 1; i++) printf("%d ", a[i] ^ s);
  printf("%d\n", a[n - 1] ^ s);
  fflush(stdout);
  return 0;
}
