#include <bits/stdc++.h>
using namespace std;

int get(int a, int b) {
    cout << "? " << a + 1 << " " << b + 1 << endl;
    int ans;
    cin >> ans;
    return ans;
}

int main() {
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    //freopen("video.in", "r", stdin); freopen("video.out", "w", stdout);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector <int> a(n);
    int k = 0;
    int tme = 3;

    map<int, int> d, p;

    for(int i = 0; i < n; i++) {
        tme++;
        int x = get(0, i);
        if(x > k) {
            a[i] = k;
            d[tme] = i;
            p[a[i]] = tme;
            k++;
            continue;
        }
        int t = 1;
        auto it = d.end();
        it--;
         while(1) {
             int q = it->second;
             if (get(q, i) == t) {
                 a[i] = a[it->second];
                 d.erase(it->first);
                 d[tme] = i;
                 p[a[i]] = tme;
                 break;
             } else {
                 t++;
             }
             if(it == d.begin()) break;
             it--;
         }
    }

    cout << "Ready!\n";
    cout << k << '\n';
    for(int i = 0; i < n; i++) cout << a[i] + 1 << " ";
    cout << endl;

    return 0;
}