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

	using namespace std;

	int main() {
		int n;
		cin >> n;
		vector<int> arr(n);
		vector<int> cnt(n);
		cnt[0] = 1;
		vector<int> d;
		arr[0] = 0;
		d.push_back(0);
		for (int i = 1; i < n; i++) {
			bool is = 0;
			bool is2 = 1;
			cout << "? " << 1 << ' ' << i + 1 << endl;
			cin >> cnt[i];
			if (cnt[i] != cnt[i - 1]) { is2 = 0; }
			for (int j = 0; j < d.size(); j++) {
				if (!is && is2) {
					int a, b;
					cout << "? " << d[j] + 1 << ' ' << i + 1 << endl;
					cin >> a;
					cout << "? " << d[j] + 2 << ' ' << i + 1 << endl;
					cin >> b;
					if (a == b) { is = 1; d[j] = i; arr[i] = j; }
				}
			}
			if (!is) { d.push_back(i); arr[i] = d.size() - 1; }
		}
		cout << "Ready!" << endl;
		cout << d.size() << endl;
		for (int i = 0; i < n; i++) {
			cout << arr[i] + 1 << ' ';
		}
		cout << endl;
		return 0;
	}