#include <bits/stdc++.h>

using namespace std;

#define int long long
#define mp make_pair
#define pb push_back


int d[3001][3001];
int a[3001];

int ask(int l, int r)
{
    if (d[l][r] != -1)
        return d[l][r];
    cout << "? " << l << ' ' << r << '\n';
    fflush(stdout);
    int k;
    cin >> k;
    d[l][r] = k;
    return k;
}

signed main()
{

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

//    freopen("video.in", "r", stdin);
//    freopen("video.out", "w", stdout);

    ios_base::sync_with_stdio(0);
//    cin.tie(0);

    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i)
        for (int j = i; j <= n; ++j)
            d[i][j] = -1;

    for (int i = 1; i <= n; ++i)
        d[i][i] = 1;

    a[1] = 1;
    int cnt = 1;
    for (int i = 2; i <= n; ++i)
    {
        int k = ask(1, i);
        if (k > d[1][i - 1])
        {
            cnt++;
            a[i] = cnt;
        }
        else
        {
            int l = 1, r = i;
            while (r - l > 1)
            {
                int m = l + (r - l) / 2;
                if (ask(m, i - 1) != ask(m, i))
                {
                    r = m;
                    for (int j = m + 1; j < i; ++j)
                        d[j][i] = d[j][i - 1] + 1;
                }

                else
                    l = m;
            }
            a[i] = a[l];
        }
    }
    cout << "Ready!\n";
    fflush(stdout);
    cout << cnt << '\n';
    fflush(stdout);
    for (int i = 1; i <= n; ++i)
        cout << a[i] << ' ';
    cout << '\n';
    fflush(stdout);

}
