#include <bits/stdc++.h>

#define vec vector
#define pb push_back
#define all(a) a.begin(), a.end()
#define re return
#define str string
#define ll long long
#define mp make_pair
#define XX first
#define YY second
#define forn(i, n) for (int i = 0; i < n; i++)

using namespace std;

int n;
int ans[3007];
int color = 0;
int kol[30007][3007], uk, rr, kkk = 0, d = 0;

int ask(int l, int r)
{
    cout << "? " << l + 1 << ' ' << r + 1 << endl;
    cout.flush();
    int k;
    cin >> k;
    return k;
}

void ok()
{
    cout << "Ready!" << endl;
    cout.flush();
    cout << color + 1 << endl;
    cout.flush();
    forn(i, n)
        cout << ans[i] + 1 << ' ';
    cout.flush();
    exit(0);
}

int raz(int l)
{
    //cout << "=====" << rr << endl;
    /*set<int> se;
    for (int i = l; i <= rr - 1; i++)
        se.insert(ans[i]);
    return se.size();*/
    /*d++;
    int ans1 = 0;
    for (int i = l; i <= rr - 1; i++)
    {
        if (kol[d][ans[i]] == 0)
            ans1++;
        kol[d][ans[i]]++;
    }
    re ans1;*/
    if (uk == -1)
    {
        for (int i = l; i <= rr - 1; i++)
        {
            if (kol[rr][ans[i]] == 0)
            {
                kkk++;
            }
            kol[rr][ans[i]]++;
        }
        //cout << l << ' ' << rr - 1 << ' ' <<  uk << ' ' <<kkk << endl;
        re kkk;
    }
    else
    if (l == uk)
    {
        //cout << l << ' ' << rr - 1 << ' ' <<  uk << ' ' <<kkk << endl;
        re kkk;
    }
    if (l < uk)
    {
        for (int i = l; i <= uk - 1; i++)
        {
            if (kol[rr][ans[i]] == 0)
            {
                kkk++;
            }
            kol[rr][ans[i]]++;
        }
        //cout << l << ' ' << rr - 1 << ' ' <<  uk << ' ' <<kkk << endl;
        re kkk;
    }
    else
    {
        for (int i = uk; i < l; i++)
        {
            kol[rr][ans[i]]--;
            if (kol[rr][ans[i]] == 0)
                kkk--;
        }
        //cout << l << ' ' << rr - 1 << ' ' << uk << ' ' <<  kkk << endl;
        re kkk;
    }
}

int main()
{
    cin >> n;
    ans[0] = 0;
    if (n == 1)
        ok();
    rr =0;
    pair<int, int> op = mp(-1, -1);
    while(rr < n - 1)
    {
        rr++;
        int l = 0, r = rr;
        uk = -1;
        kkk = 0;
        while(l + 1 != r)
        {
            int m = (l + r) / 2;
            int ra = raz(m);
            uk = m;
            int q = ask(m, rr);
            op = mp(m, q);
            if (q > ra)
                r = m;
            else
                l = m;
        }
        int qq;
        if (op.XX == l)
            qq = op.YY;
        else
            qq = ask(l, rr);
        if (raz(l) == qq)
            ans[rr] = (ans[l]);
        else
            ans[rr] = (++color);

    }
    ok();
}
