#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;

const int MAXN = 3005;

vector <int> last;                  
int arr[MAXN];
int n;
int k;
map <pair <int, int>, int> mind;

int ask(int l, int r)
{
	if (l == r)
		return 1;
	if (l > r)
		return 0;
	int x;
	if (mind.count(mp(l, r)) != 0)
		return mind[mp(l, r)];

	cout << "? " << l + 1 << ' ' << r + 1 << endl;
	cin >> x;
	mind[mp(l, r)] = x;
	return x;
}
                  

void rem(int x)
{
	forn(i, sz(last))
		if(last[i] == x)
		{
			while (i != sz(last) - 1)
			{
				swap(last[i], last[i + 1]);
				i++;
			}
			last.pop_back();
			
			return;
	       	}
	 throw;
}

void ins(int x)
{
	last.pb(x);
	sort(all(last));
}

int main()
{       
	cin >> n;
	
	forn(i, n)
	{
		int am = ask(0, i);
		assert(am == k + 1 || am == k);

		if (am == k + 1)
		{
			arr[i] = ++k;
			ins(i);
		}
		else
		{
			int bl = 0;
			int br = sz(last);

			while (br - bl > 1)
			{
				int bm = (bl + br) / 2; 
				
				if (ask(last[bm], i) == ask(last[bm], i - 1))
					bl = bm;
				else
					br = bm;
			}

			arr[i] = arr[last[bl]];
			rem(last[bl]);
			ins(i);
		}                        
	}

	cout << "Ready!" << endl;

	cout << k << endl;

	forn(i, n)
		cout << arr[i] << ' ';


	return 0;
}