#include <bits/stdc++.h>
using namespace std;
int n;
int ans[10000];
int ans_cnt;
int xo[10000];
int yo[10000];
int res[5005];
int pos[5005];
int get(int i, int j) {
  string a, b;
  while (i) {
    a += i % 10 + '0';
    i /= 10;
  }
  while (j) {
    b += j % 10 + '0';
    j /= 10;
  }
  if (a.size() == 0) a = "0";
  if (b.size() == 0) b = "0";
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  string query = "? " + a + " " + b;
  fflush(stdout);
  cout << query << endl;
  fflush(stdout);
  int res;
  fflush(stdout);
  cin >> res;
  fflush(stdout);
  return res;
}
bool check(int x) {
  for (int i = 0; i < n; i++) res[i] = -1;
  for (int i = 0; i < n; i++) {
    pos[i] = xo[i] ^ x;
    if (pos[i] >= n) return 0;
  }
  for (int i = 0; i < n; i++) {
    if (res[pos[i]] != -1) return 0;
    res[pos[i]] = i;
  }
  if (res[0] != x) return 0;
  return 1;
}
bool check2(int y) {
  for (int i = 0; i < n; i++) {
    if ((yo[i] ^ y) != res[i]) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  fflush(stdout);
  cin >> n;
  fflush(stdout);
  for (int i = 0; i < n; i++) xo[i] = get(0, i);
  for (int i = 0; i < n; i++) yo[i] = get(i, 0);
  for (int i = 0; i < n; i++) {
    if (check(i) && check2(pos[0])) {
      if (!ans_cnt)
        for (int j = 0; j < n; j++) ans[j] = res[j];
      ans_cnt++;
    }
  }
  fflush(stdout);
  cout << '!' << endl;
  fflush(stdout);
  cout << ans_cnt << endl;
  for (int i = 0; i < n; i++) {
    fflush(stdout);
    cout << ans[i];
    fflush(stdout);
    cout << ' ';
    fflush(stdout);
  }
}
