#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

const int maxn = 3005;

int n;
int k = 1;
int ans[maxn], arr[maxn];
bool islast[maxn];
int lasts[maxn];

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n;
	ans[1] = arr[1] = islast[1] = 1;
	for (int i = 2; i <= n; ++i) {
		cout << "? 1 " << i << endl;
		cout.flush();
		cin >> arr[i];
		if (arr[i] == arr[i - 1]) {
			if (k == 1) ans[i] = 1, islast[i] = true, islast[i - 1] = false, lasts[1] = i;
			else {
				int p, t;
				int l = 1, r = k + 1;
				while (r - l > 1) {
					int md = l + (r - l) / 2;
					int j = lasts[md];
					cout << "? " << j << " " << i << endl;
					cout.flush();
					cin >> p;
					cout << "? " << j + 1 << " " << i << endl;
					cout.flush();
					cin >> t;
					if (p == t) l = md; else r = md;
				}
				int j = lasts[l];
				ans[i] = ans[j];
				islast[j] = false;
				islast[i] = true;
				for (int u = l; u <= k; ++u) lasts[u] = lasts[u + 1];
				lasts[k] = i;
			}
		}
		else {
			k = arr[i];
			ans[i] = k;
			islast[i] = true;
			lasts[k] = i;
		}
	}
	cout << "Ready!" << endl;
	cout << k << endl;
	for (int i = 1; i <= n; ++i)
		cout << ans[i] << " ";
	cout.flush();
	return 0;
}