#include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <unordered_map>
#include <map>

using namespace std;

bool bb[3050][3050];
int r[3050], p[3050];
unordered_map<int, int> st;

int get(int v){
    if (p[v] == v)
        return v;
    return p[v] = get(p[v]);
}

void union_set(int a, int b){
    a = get(a);
    b = get(b);
    if (a == b)
        return ;
    if (r[a] < r[b])
        swap(a, b);
    if (r[a] == r[b])
        r[a]++;
    p[b] = a;
}

int color[3050];

int main(){
    //freopen("video.in", "r", stdin);
    //freopen("video.out", "w", stdout);
    int n;
    for (int i = 0; i < 3050; i++){
        p[i] = i;
        r[i] = 1;
    }
    cin >> n;
    int b, a;
    for (int k = 0; k < 12; k++){
        int ans = 0;
        vector<pair<int, int> > mrg;
        for (int i = 0; i < (1 << k); i++){
            b = get(i);
            if (st.count(b) != 0){
                st[b]++;
            }else
                st[b] = 1;
            if (st[b] == 1)
                ans++;
        }
        for (int i = 0; i < n; i++){
            if (i + (1 << k) < n){
                b = get(i + (1 << k));
                if (st.count(b) != 0){
                    st[b]++;
                }else
                    st[b] = 1;
                if (st[b] == 1)
                    ans++;
                cout << "? "<< i + 1 << " " << i + (1 << k) + 1 << endl;
                cin >> a;
                //cout << a << " " << ans << endl;
                if (a != ans){

                    mrg.push_back(make_pair(i, i + (1 << k)));
                }
            }
            b = get(i);
            st[b]--;
            if (st[b] == 0)
            ans--;
        }
        for (int i = 0; i < mrg.size(); i++)
            union_set(mrg[i].first, mrg[i].second);
    }
    int num = 0;
    for (int i = 0; i < n; i++)
        if (color[get(i)] == 0){
            num++;
            color[get(i)] = num;
        }
    cout << "Ready!" << endl;
    cout << num << endl;
    for (int i = 0; i < n; i++)
        cout << color[get(i)] << " ";
    return 0;
}
