#include <bits/stdc++.h>
using namespace std;
vector<long long> grph[5005];
long long vis[5005] = {0};
long long ans[5005] = {0};
int32_t main() {
  cin.tie(0);
  long long n;
  cin >> n;
  long long qry[2 * n];
  long long i;
  for (i = 0; i < (2 * n) - 1; i++) {
    cout << "? " << (i + 1) / 2 << " " << i / 2 << endl;
    cin >> qry[i];
  }
  long long s = 0;
  long long ans[n];
  for (i = 0; i < n; i++) {
    long long p[n], b[n];
    p[0] = i;
    long long flag = 0;
    for (long long j = 0; j < (2 * n) - 1; j++) {
      if (j % 2 == 0) {
        b[j / 2] = p[j / 2] ^ qry[j];
        if (b[j / 2] >= n) flag = 1;
      } else {
        p[(j + 1) / 2] = b[(j - 1) / 2] ^ qry[j];
        if (p[(j + 1) / 2] >= n) flag = 1;
      }
    }
    if (flag == 0) {
      for (long long j = 0; j < n; j++) {
        if (j != b[p[j]]) flag = 1;
      }
    }
    if (flag == 0) {
      s++;
      for (long long j = 0; j < n; j++) ans[j] = p[j];
    }
  }
  cout << "!" << endl;
  cout << s << endl;
  for (i = 0; i < n; i++) cout << ans[i] << " ";
}
