#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

using namespace std;

int s[3000];

vector<int> g, h;

int main() {
    int n;
    cin >> n;
    s[0] = 1;
    g.push_back(1);
    h.push_back(1);
    int a;
    for (int i = 1; i < n; i++) {
        int L = -1;
        int R = g.size();
        while (R - L > 1) {
            int m = (R + L) / 2;
            cout << "? " << g[m] << ' ' << i + 1 << '\n';
            cout.flush();
            cin >> a;
            if (a != h[m]) {
                R = m;
            }
            else {
                L = m;
            }
        }
        if (L == -1) {
            g.push_back(i + 1);
            h.push_back(0);
            s[i] = (int)g.size();
            for (int j = 0; j < g.size(); j++) {
                h[j] += 1;
            }
        }
        else {
            s[i] = s[g[L] - 1];
            for (int j = L; j < g.size() - 1; j++) {
                g[j] = g[j + 1];
                h[j] = h[j + 1] + 1;
            }
            g[g.size() - 1] = i + 1;
            h[g.size() - 1] = 1;
        }
        /*bool f = 1;
        for (int j = g.size() - 1; j >= 0; j--) {
            cout << "? " << g[j] << ' ' << i + 1 << '\n';
            cout.flush();
            cin >> a;
            if (a != h[j]) {
                h[j] = a;
            }
            else {
                s[i] = s[g[j] - 1];
                for (int l = j; l < g.size() - 1; l++) {
                    g[l] = g[l + 1];
                    h[l] = h[l + 1];
                }
                g[g.size() - 1] = i + 1;
                h[g.size() - 1] = 1;
                f = 0;
                break;
            }
        }
        if (f) {
            g.push_back(i + 1);
            h.push_back(1);
            s[i] = (int)g.size();
        }
        for (int j = 0; j < n; j++) {
            cout << s[j] << ' ';
        }
        cout << '\n';
        for (int j = 0; j < g.size(); j++) {
            cout << g[j] << ' ' << h[j] << '\n';
        }*/
    }
    cout << "Ready!\n";
    cout << g.size() << '\n';
    for (int i = 0; i < n; i++) {
        cout << s[i] << ' ';
    }
    return 0;
}

