#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1000000000;
const ll LINF = 1001002003004005006ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < (int)v.size(); i++)
    os << v[i] << (i + 1 == (int)v.size() ? "" : " ");
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v) is >> x;
  return is;
}
signed main() {
  int n;
  cin >> n;
  vector<int> bx;
  for (int i = 0; i < (n); i++) {
    cout << "? " << 0 << " " << i << endl;
    int x;
    cin >> x;
    bx.push_back(x);
  }
  vector<int> px;
  for (int i = 0; i < (n); i++) {
    cout << "? " << i << " " << 0 << endl;
    int x;
    cin >> x;
    px.push_back(x);
  }
  int cnt = 0;
  vector<int> print_res;
  for (int i = 0; i < (n); i++) {
    bool f = true;
    vector<int> b;
    for (auto x : bx) b.push_back(x ^ i);
    auto v = b;
    sort(begin(v), end(v));
    for (int j = 0; j < (n); j++)
      if (v[j] != j) f = false;
    if (!f) continue;
    vector<int> p;
    for (auto x : px) p.push_back(x ^ b[0]);
    for (int j = 0; j < (n); j++)
      if (p[b[j]] != j) f = false;
    if (!f) continue;
    cnt++;
    print_res = p;
  }
  cout << "!" << endl;
  cout << cnt << endl;
  cout << print_res << endl;
  return 0;
}
