#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

#pragma warning (disable:4996)

#define mlp make_pair
#define ll long long int
#define x1 first
#define y1 second

int n, ans[3007], s[3007], now = 1;
vector<int> v;
map<int, int> q;
map<pair<int, int>, int> w;

int ask(int x, int y) {
	if (w[mlp(x, y)] == 0) {
		if (x == y) {
			w[mlp(x, y)] = 1;
		}
		else {
			cout << "? " << x + 1 << " " << y + 1 << endl;
			cin >> w[mlp(x, y)];
		}
	}
	return w[mlp(x, y)];
}

void sol() {
	int i, j, l, r, m, a, b, x, y, k;
	cin >> n;
	k = ask(0, n - 1);
	ans[0] = 1;
	now++;
	q[1] = 0;
	for (i = 1; i < n; i++) {
		if (k == n - i) {
			ans[i] = now;
			now++;
			k -= 1;
		}
		else {
			v.clear();
			for (auto it = q.begin(); it != q.end(); it++) {
				v.push_back(it->y1);
			}
			sort(v.begin(), v.end());
			l = 0;
			r = v.size();
			while (r - l > 1) {
				m = (l + r) / 2;
				x = v[m];
				y = i;
				a = ask(x, y);
				y = i - 1;
				b = ask(x, y);
				if (a == b) {
					l = m;
				}
				else {
					r = m;
				}
			}
			x = v[l];
			y = i;
			if (ask(x, y) == ask(x, y - 1)) {
				ans[i] = ans[v[l]];
			}
			else {
				ans[i] = now;
				now++;
				k -= 1;
			}
			q[ans[i]] = i;
		}
	}
	cout << "Ready!" << endl << now - 1 << endl;
	for (i = 0; i < n; i++) {
		cout << ans[i];
		if (i != n - 1)cout << " ";
	}
	cout << endl;
	i = 1;
}

int main() {


	sol();

}