#include int main() { using namespace std; unsigned long N; cin >> N; vector A{1}; const auto query{[](auto i, auto j){ cout << "? " << i << " " << j << endl; unsigned long t; cin >> t; return t; }}; for(unsigned long i{2}; i <= N; ++i){ if(query(A.back(), i))A.emplace_back(i); else if(query(i, A[0]))A.insert(begin(A), i); else{ unsigned long l{0}, r{size(A)}; while(l + 1 < r){ auto m{(l + r) / 2}; (query(A[m], i) ? l : r) = m; } A.insert(begin(A) + r, i); } } cout << "!" << endl; cout << N - 1 << endl; for(const auto a : A)cout << a << " "; cout << endl; return 0; }