#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;

const int N = 3000;

int a[N];
int know[N][N];
int n, k;
int q;

int ask(int i, int j) {
    assert(i <= j);
    if (know[i][j] != -1) return know[i][j];
    if (i == j) return 1;
    assert(++q <= 36000);
    printf("? %d %d\n", i + 1, j + 1);
    fflush(stdout);
    int ret;
    scanf("%d", &ret);
    know[i][j] = ret;
    return ret;
}

void ready() {
    puts("Ready!");
    fflush(stdout);
    printf("%d\n", k);
    fflush(stdout);
    for (int i = 0; i < n; i++) {
        printf("%d ", a[i] + 1);
    }
    puts("");
    fflush(stdout);
}

void solve() {
    k = ask(0, n - 1);
    bool used[n];
    memset(used, 0, sizeof used);
    for (int col = 0; col < k; col++) {
        int i = 0;
        while (used[i]) i++;

        a[i] = col;
        used[i] = true;

        while (i < n) {
            int lb = i, rb = n;
            while (lb + 1 < rb) {
                int mb = (lb + rb) / 2;
                int cnt1 = ask(i, mb);
                int cnt2 = ask(i + 1, mb);
                if (cnt1 == cnt2) rb = mb;
                else lb = mb;
            }
            i = rb;
            a[i] = col;
            used[i] = true;
        }
    }

    ready();
}

int main() {
    memset(know, -1, sizeof know);
    scanf("%d", &n);
    solve();
}
