#include using namespace std; int edge[2010][2010]; int tmp[2020]; int arr[2020]; void merge_sort(int idx, int _n) { if (_n == 1) return; auto t = _n / 2; merge_sort(idx, t); merge_sort(idx + t, _n - t); int i = idx, j = idx + t; int cnt = 0; while (i < idx + t && j < idx + _n) { cout << "? " << arr[i] + 1 << " " << arr[j] + 1 << endl; int h; cin >> h; if (h) { tmp[cnt++] = arr[i++]; } else { tmp[cnt++] = arr[j++]; } } while (i < idx + t) { tmp[cnt++] = arr[i++]; } while (j < idx + _n) { tmp[cnt++] = arr[j++]; } for (int k = 0; k < _n; k++) { arr[idx + k] = tmp[k]; } return; } int main(){ int n; cin >> n; for (int i = 0; i < n; i++) arr[i] = i; merge_sort(0, n); cout << "!" << endl; cout << n - 1 << endl; for (int i = 0; i < n; i++) cout << arr[i] + 1 << (i == n - 1? "\n": " "); return 0; }