#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <fstream>

using namespace std;

bool testMode;
int n;

vector<int> e;

int ask(int l, int r) { // 0based []
	if (testMode) {
		set<int> s;
		for (int i = l; i <= r; ++i) {
			s.insert(e[i]);
		}
		cout << "? " << l + 1 << " " << r + 1 << " -> " << s.size() << "\n";
		return s.size();
	} else {
		cout << "? " << l + 1 << " " << r + 1 << endl;
		int ans;
		cin >> ans;
		return ans;
	}
}

int main() {
#ifdef _DEBUG
	//freopen("in.txt", "r", stdin);
#else
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
#endif
	cin.sync_with_stdio(0);
	cin.tie(0);

	// hi daniil

	cin >> n;
	if (n == -1) {
		cout << "starting test mode\n";
		testMode = 1;
		ifstream f("in.txt");
		f >> n;
		e.resize(n);
		for (int i = 0; i < n; ++i) {
			f >> e[i];
			cout << e[i] << " ";
		}
		cout << "\n";
	}

	vector<int> a(n, -1); // hack VS
	a[0] = 1;

	int k = 1;
	vector<int> d;

	for (int i = 1; i < n; ++i) {
		d.resize(i);
		set<int> s;
		for (int j = i - 1; j >= 0; --j) {
			s.insert(a[j]);
			d[j] = s.size();
			/*if (ask(j, i) != (int)s.size() + 1) {
				a[i] = a[j];
				break;
			}*/
		}
		int r = i;
		int l = -1;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (d[m] + 1 == ask(m, i)) {
				r = m;
			} else {
				l = m;
			}
		}
		if (l != -1) a[i] = a[l];
		if (a[i] == -1) {
			a[i] = ++k;
		}
	}

	cout << "Ready!\n";
	cout << k << "\n";
	for (int i = 0; i < n; ++i) {
		cout << a[i] << " ";
	}
	cout << "\n";

	return 0;
}
