#include <iostream>
#include <vector>

using namespace std;

vector < vector < int > > q;

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	int n;
	cin >> n;
	n++;
	int cn = 0;
	vector <int> a;
	a.resize(n + 1);
	q.resize(n + 1, vector <int>(n + 1, -1));
	q[1][0] = 0;
	for (int i = 1; i < n; i++) {
		cout << "? 1 " << i << endl;
		int x;
		cin >> x;
		q[1][i] = x;
		if (x != q[1][i - 1]) {
			a[i] = cn++;
			q[1][i] = q[1][i - 1] + 1;
		}
		else {
			int l, r;
			l = 1;
			r = i;
			while (l != r - 1) {
				int m = (l + r) / 4;
				int x, y;
				if (q[m][i] == -1) {
					cout << "? " << m << ' ' << i << endl;
					cin >> x;
					q[m][i] = x;
				}
				else {
					x = q[m][i];
				}
				if (q[m][i - 1] == -1) {
					cout << "? " << m << ' ' << i - 1 << endl;
					cin >> y;
					q[m][i - 1] = y;
				}
				else {
					y = q[m][i - 1];
				}
				if (x == y)
					l = m;
				else
					r = m;
			}
			a[i] = a[l];
		}
	}
	cout << "Ready!" << endl;
	cout << cn << endl;
	for (int i = 0; i < n - 1; i++) {
		cout << a[i + 1] + 1 << ' ';
	}
	return 0;
}