#include <iostream>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>

using namespace std;

int a[5000], n, k, k1;
int mark[5000][5000];

int main()
{
    cin >> n;
    int ct = 1;
    a[0] = ct++;
    for (int i = 1; i < n; i++)
    {
        cout << "? " << i << ' ' << i + 1 << endl;
        fflush(stdout);
        cin >> k;
        mark[i][i + 1] = k;
        int pre = k;
        if (k == 1)
            a[i] = a[i - 1];
        else
        {
            int l = 0, r = i;
            while (l + 1 < r)
            {
                int m = (l + r) / 2;
                if (!mark[m + 1][i + 1])
                {
                    cout << "? " << m + 1 << ' ' << i + 1 << endl;
                    fflush(stdout);
                    cin >> k;
                    mark[m + 1][i + 1] = k;
                }
                if (!mark[m + 1][i])
                {
                    cout << "? " << m + 1 << ' ' << i << endl;
                    fflush(stdout);
                    cin >> k1;
                    mark[m + 1][i] = k1;
                }
                k = mark[m + 1][i + 1];
                k1 = mark[m + 1][i];
                if (k1 == k)
                    l = m;
                else
                    r = m;
            }
            if (!mark[l + 1][i + 1])
            {
                cout << "? " << l + 1 << ' ' << i + 1 << endl;
                fflush(stdout);
                cin >> k;
                mark[l + 1][i + 1] = k;
            }
            if (!mark[l + 1][i])
            {
                cout << "? " << l + 1 << ' ' << i << endl;
                fflush(stdout);
                cin >> k1;
                mark[l + 1][i] = k1;
            }
            k = mark[l + 1][i + 1];
            k1 = mark[l + 1][i];
            if (k == k1)
                a[i] = a[l];
            else
                a[i] = ct++;
        }
    }
    cout << "Ready!" << endl;
    cout << ct - 1 << endl;
    for (int i = 0; i < n; i++)
        cout << a[i] << ' ';
    return 0;
}
