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

public class Tests {
    private static File dir = new File("tests");
    private int curTest = 1;
    private static boolean verbose = true;

    private String testName;
    private PrintWriter out;
    private Random r = new Random(5516681322906813814L);
    
    public static final int MAX = 200_000;
    public static final int MIN_A = 1;
    public static final int MAX_A = 1_000_000_000;
    public static final int M = 3;

    public void run() {
        t(5, 6, 6, 6, 23, 9);
        t(1);
        t(1, 1);
        t(1, 2);
        t(7, 7, 7);
        t(MAX_A, MAX_A, MAX_A, MAX_A);
        t(1, 2, 2, 2);
        t(2, 2, 2, 1);
        t(1, 2, 2, 2, 2);
        t(2, 2, 2, 2, 1);
        for (int i = 2; i <= 6; i++) {
            tRandom(MAX, i);
        }
        tRandom(MAX, MAX);
        for (int i = 20; i <= 100; i += 40) {
            tRandom(MAX, i);
            tBigAns(MAX, i);
        }
    }
    
    void tRandom(int n, int different) {
        TreeSet<Integer> values = new TreeSet<>();
        while (values.size() < different) {
            values.add(r());
        }
        ArrayList<Integer> valuesList = new ArrayList<>(values);
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = valuesList.get(r.nextInt(different));
        }
        t(a);
    }

    void tBigAns(int n, int different) {
        TreeSet<Integer> values = new TreeSet<>();
        while (values.size() < different) {
            values.add(r());
        }
        ArrayList<Integer> valuesList = new ArrayList<>(values);
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            do {
                a[i] = valuesList.get(r.nextInt(different));
            } while (i > n / 10 && i < n - n / 10 && a[i] == a[i - 1] && a[i] == a[i - 2]);
        }
        t(a);
    }

    private void t(int... a) {
        open();
        out.println(a.length);
        for (int i = 0; i < a.length; i++) {
            if (i > 0) {
                out.print(" ");
            }
            out.print(a[i]);
        }
        out.println();
        close();
    }
    
    public int r() {
        return r.nextInt(MAX_A + 1 - MIN_A) + MIN_A;
    }

    private void open() {
        try {
            testName = "" + curTest / 10 + curTest % 10;
            out = new PrintWriter(new File(dir, testName));
            if (verbose) { 
                System.out.print("Generating " + testName + "...");
            }
        } catch (IOException e) {
            throw new RuntimeException("Unable to open " + testName + " for writing", e);
        }
    }

    private void close() {
        out.close();
        if (verbose) {
            System.out.println(" done.");
        }
        curTest++;
    }

    public static void main(String[] args) {
        Locale.setDefault(Locale.US);
        dir.mkdirs();
        new Tests().run();
    }
}
