#include #include using mint = atcoder::static_modint<998244353>; //using mint = atcoder::static_modint<1000000007>; using namespace std; using namespace atcoder; using ld = long double; using ll = long long; #define mp(a,b) make_pair(a,b) #define rep(i,s,n) for(int i=s; i dx{1,0,-1,0},dy{0,1,0,-1}; deque solve(dequep){ int n=p.size(); if(n==1)return p; int h=n/2; deque a,b; rep(i,0,h)a.push_back(p.front()),p.pop_front(); while(p.size()){ b.push_back(p.front()); p.pop_front(); } a=solve(a); b=solve(b); int t; // cout << "? " << a.back() << " " << b.front() << "\n"; // cin >> t; // if(t==1){ // for(auto x:b)a.push_back(x); // return a; // } // cout << "? " << b.back() << " " << a.front() << "\n"; // cin >> t; // if(t==1){ // for(auto x:a)b.push_back(x); // return b; // } p.clear(); while(a.size()*b.size()){ int u=a.front(),v=b.front(); cout << "? " << u << " " << v << "\n"; cin >> t; if(t==1){ a.pop_front(); p.push_back(u); } else{ b.pop_front(); p.push_back(v); } } while(a.size())p.push_back(a.front()),a.pop_front(); while(b.size())p.push_back(b.front()),b.pop_front(); return p; } int main(){ int n;cin >> n; deque a(n); iota(a.begin(),a.end(),1); a=solve(a); cout << "!\n" << n-1 << "\n"; for(auto x:a)cout << x << " "; }