#include <bits/stdc++.h>
using namespace std;
int vec[2][5050];
int tmp[5050];
int res[5050];
int n;
void solve() {
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; j++) {
      tmp[j] = (vec[0][j] ^ i);
    }
    bool ok = true;
    for (int j = 0; j < n; j++) {
      int ss = (tmp[0] ^ vec[1][j]);
      if (ss >= n || tmp[ss] != j) {
        ok = false;
      }
    }
    if (!ok) continue;
    if (!cnt) {
      cnt = 1;
      for (int k = 0; k < n; ++k) res[k] = tmp[k];
    } else
      cnt++;
  }
  cout << "!" << endl;
  cout << cnt << endl;
  for (int i = 0; i < n; i++) {
    cout << res[i] << " ";
  }
  puts("");
}
int main() {
  cin >> n;
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < n; ++j) {
      int t;
      if (i == 0) {
        cout << "? " << j << " 0" << endl;
        cin >> t;
        vec[i][j] = t;
      } else {
        cout << "? "
             << "0 " << j << endl;
        cin >> t;
        vec[i][j] = t;
      }
    }
  }
  solve();
  return 0;
}
