#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define size(s) (int) (s).size()

int main() {
	int n, last = 1;
	cin >> n;
	vector<int> ans(n), uniq, uniqId;
	uniq.push_back(1);
	uniqId.push_back(0);
	ans[0] = last;
	last++;
	for (int i = 1; i < n; i++) {
		if (size(uniq) == 1) {
			int k;
			cout << "? " << uniqId[0] + 1 << ' ' << i + 1 << endl;
			cin >> k;
			if (k == 2) {
				ans[i] = last;
				uniq.push_back(last);
				uniqId.push_back(i);
				last++;
			} else {
				ans[i] = uniq[0];
				uniqId[0] = i;
			}
		} else {
			int l = 0, r = size(uniq);
			while (r - l > 1) {
				int m = (l + r) / 2, k;
				cout << "? " << uniqId[m] + 1 << ' ' << i + 1 << endl;
				cin >> k;
				if (k < size(uniq) - m + 1) {
					l = m;
				}
				else {
					r = m;
				}
			}
			if (l == size(uniq) - 1) {
				ans[i] = last;
				uniq.push_back(last);
				uniqId.push_back(i);
				last++;
			}
			else {
				ans[i] = uniq[l + 1];
				uniqId[l + 1] = i;
			}
		}
	}
	cout << "Ready!" << endl << last - 1 << endl;
	for (int i = 0; i < n; i++) {
		cout << ans[i] << ' ';
	}
	cout << endl;
	return 0;
}

