#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using Int = long long; template ostream &operator<<(ostream &os, const pair &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template ostream &operator<<(ostream &os, const vector &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; } template void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; } template bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; } // Sorts [first, last) so that for any adjacent elements a, b in this order, // comp(a, b) || !comp(b, a) // [buffer, buffer + floor((last - first) / 2)) must be available. template void mergeSort(Iter first, Iter last, Iter buffer, Comp comp) { if (last - first >= 2) { Iter middle = first + (last - first) / 2; mergeSort(first, middle, buffer, comp); mergeSort(middle, last, buffer, comp); Iter i = first, j = first, k = buffer, l = buffer; for (; j != middle; ) *l++ = std::move(*j++); for (; k != l && j != last; ) *i++ = comp(*j, *k) ? *j++ : *k++; for (; k != l; ) *i++ = std::move(*k++); } } template void mergeSort(T *first, T *last, Comp comp) { vector buffer((last - first) / 2); mergeSort(first, last, buffer.data(), comp); } template void mergeSort(vector &as, Comp comp) { vector buffer(as.size() / 2); mergeSort(as.begin(), as.end(), buffer.begin(), comp); } //////////////////////////////////////////////////////////////////////////////// int Ask(int u, int v) { printf("? %d %d\n", u + 1, v + 1); fflush(stdout); int t; scanf("%d", &t); return t; } int main() { int N; scanf("%d", &N); vector us(N); for (int u = 0; u < N; ++u) { us[u] = u; } mergeSort(us, Ask); puts("!"); printf("%d\n", N - 1); for (int j = 0; j < N; ++j) { if (j) printf(" "); printf("%d", us[j] + 1); } puts(""); return 0; }