#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cmath>
#include <ctime>
#include <string>
#include <cstring>

#pragma comment(linker, "/STACK:256000000")

using namespace std;

typedef long long int ll;
typedef long double ld;

const int INF = (1 << 29) + 5;
const ll LLINF = (1ll << 59) + 5;
const int MAX_N = 3005;


int n;
int prev_of[MAX_N];
int answer[MAX_N];
map<int, int> go;
vector<int> diff;

int dsu_get(int v)
{
	return (v == prev_of[v]) ? v : (prev_of[v] = dsu_get(prev_of[v]));
}

void dsu_un(int v1, int v2)
{
	v1 = dsu_get(v1);
	v2 = dsu_get(v2);

	if (v1 != v2)
	{
		prev_of[v2] = v1;
	}
}

set<int> gg;
int cnt_sim(int l, int r)
{
	gg.clear();
	for (int i = l; i <= r; ++i)
	{
		gg.insert(dsu_get(i));
	}

	return gg.size();
}

int main()
{
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);

	scanf("%d", &n);

	for (int i = 1; i <= n; ++i)
	{
		prev_of[i] = i;
	}

	int x;
	diff.push_back(1);
	for (int i = 1; i <= n - 1; ++i)
	{
		printf("? %d %d\n", i, i + 1);
		fflush(stdout);
		scanf("%d", &x);
		if (x == 2)
		{
			diff.push_back(i + 1);
		}
		else
		{
			dsu_un(i, i + 1);
		}
	}

	int cnt_diff = 1;
	int l, r;
	int m;
	for (int i = 1; i < diff.size(); ++i)
	{
		printf("? 1 %d\n", diff[i]);
		fflush(stdout);
		scanf("%d", &x);
		if (x != cnt_sim(0, i - 1) + 1)
		{
			l = 1;
			r = i;
			while (r - l > 1)
			{
				m = (l + r) >> 1;
				printf("? %d %d\n", dsu_get(diff[m]), diff[i]);
				fflush(stdout);
				scanf("%d", &x);
				if (x == cnt_sim(m, i - 1) + 1)
				{
					l = m;
				}
				else
				{
					r = m;
				}
			}
			dsu_un(diff[r], diff[i]);
		}
		else
		{
			++cnt_diff;
		}
	}
	
	set<int> tt;
	for (int i = 1; i <= n; ++i)
	{
		tt.insert(dsu_get(i));
	}

	int cnt = 1;
	for (auto it = tt.begin(); it != tt.end(); ++it)
	{
		go[*it] = cnt;
		++cnt;
	}

	printf("Ready!\n");
	printf("%d\n", cnt_diff);
	for (int i = 1; i <= n; ++i)
	{
		printf("%d ", go[dsu_get(i)]);
	}
	fflush(stdout);

	cout << endl;
	system("pause");
	
	fclose(stdin);
	fclose(stdout);

	return 0;
}