import java.io.*;
import java.util.*;

/**
 * Created by roi on 07.04.2016.
 */
public class Task6 {

    void solve(IO io) {
        int n = io.n();
        int[] ans = new int[n];
        ans[0] = 1;

        int max = 1;
        for (int i = 1; i < n; i++) {
            for (int j = i - 1; j >= 0; j--) {
                int res = io.safeAsk(j, i);
                int cnt = io.safeAsk(j, i - 1);

                if (res == cnt) {
                    ans[i] = ans[j];
                    break;
                }
            }

            if (ans[i] == 0) {
                ans[i] = ++max;
            }
        }

        if (max != io.ask(0, n - 1)) throw new AssertionError();

        io.finish(ans, max);
    }


    public static void main(String[] args) {
        Task6 solver = new Task6();
        solver.solve(new RealIO());
    }

    abstract static class IO {
        abstract int n();

        abstract int ask(int i, int j);

        abstract void finish(int[] ans, int cnt);

        int[][] cache = new int[3001][3001];

        int safeAsk(int i, int j) {
            if (i == j) return 1;
            if (cache[i][j] == 0) {
                cache[i][j] = ask(i, j);
            }
            return cache[i][j];
        }
    }


    static class DebugIO extends IO {
        DebugIO() {
            try {
                BufferedReader in = new BufferedReader(new FileReader("decode.txt"));
                String[] ss = in.readLine().split(" ");
                seq = new int[ss.length];
                for (int i = 0; i < ss.length; i++) {
                    seq[i] = Integer.parseInt(ss[i]);
                }
            } catch (IOException e) {
                e.printStackTrace();
                seq = new int[0];
            }
        }

        int[] seq;

        @Override
        int n() {
            return seq.length;
        }

        int reqCnt = 0;

        @Override
        int ask(int i, int j) {
            reqCnt++;
            HashSet<Integer> set = new HashSet<>();
            for (int k = i; k <= j; k++) {
                set.add(seq[k]);
            }
            return set.size();
        }

        @Override
        void finish(int[] ans, int cnt) {
            System.err.println(reqCnt + " requests");
            if (Arrays.equals(ans, seq)) {
                System.err.println("OK");
            } else {
                System.err.println("wtf?");
            }
        }
    }


    static class RealIO extends IO {

        public int ask(int i, int j) {
            System.out.println("? " + (i + 1) + " " + (j + 1));
            return nextInt();
        }

        public void finish(int[] ans, int cnt) {
            StringBuilder builder = new StringBuilder("Ready!\n");
            builder.append(cnt).append('\n');
            for (int i : ans) builder.append(i).append(' ');
            System.out.println(builder);
        }

        int _n;

        public int n() {
            return _n;
        }

        BufferedReader in;
        StringTokenizer tok;


        RealIO() {
            in = new BufferedReader(new InputStreamReader(System.in));
            _n = nextInt();
        }

        String nextToken() {
            if (tok == null || !tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }
            return tok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }
    }

}
