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

public class ProblemB {

  public static void main(String[] args) throws IOException {
    init();
    new ProblemB().run();
    out.flush();
    out.close();
  }

  static void init() throws IOException {
    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    in.ordinaryChars(0, 65535);
    in.wordChars(0, 65535);
    in.whitespaceChars(' ', ' ');
    in.whitespaceChars('\n', '\n');
    in.whitespaceChars('\r', '\r');
  }

  // класс для пар
  class Pair<L, R> {
    private final L X;
    private final R Y;

    public Pair(L X, R Y) {
      this.X = X;
      this.Y = Y;
    }

    public L getX() {
      return X;
    }

    public R getY() {
      return Y;
    }

    @Override
    public int hashCode() {
      return X.hashCode() ^ Y.hashCode();
    }

    @Override
    public boolean equals(Object o) {
      if (!(o instanceof Pair)) return false;
      Pair pairo = (Pair) o;
      return X.equals(pairo.getX()) && Y.equals(pairo.getY());
    }
  }

  static final long INFL = 200000000000000000L;
  static final int INF = 2000000000;
  static final boolean DEBUG = true;

  static StreamTokenizer in;
  static PrintWriter out;

  static void print(String s) {
    print(s, 0);
  }

  static void print(String s, int debug) {
    if (debug == 0 || DEBUG) {
      out.print(s);
    }
  }

  static void println(String s) {
    println(s, 0);
  }

  static void println(String s, int debug) {
    if (debug == 0 || DEBUG) {
      out.println(s);
    }
  }

  static void printArray(int[] arr) {
    println(Arrays.toString(arr));
  }

  static void printArray(char[] arr) {
    println(Arrays.toString(arr));
  }

  static void printArray(String[] arr) {
    println(Arrays.toString(arr));
  }

  static char[] inChars;
  static int inCharsInd;

  static String next() throws IOException {
    in.nextToken();
    return in.sval;
  }

  static char nextChar() throws IOException {
    while (inChars == null || inCharsInd >= inChars.length) {
      inChars = next().toCharArray();
      inCharsInd = 0;
    }
    return inChars[inCharsInd++];
  }

  static int nextInt() throws IOException {
    return Integer.valueOf(next());
  }

  static double nextDouble() throws IOException {
    return Double.valueOf(next());
  }

  static long nextLong() throws IOException {
    return Long.valueOf(next());
  }

  private void run() throws IOException {
    solve();
  }

  int K, L, M, N, P;

  private void solve() throws IOException {
    N = nextInt();
    int[] arr = new int[N];
    for (int i = 0; i < N; i++) {
      arr[i] = nextInt();
    }
    Arrays.parallelSort(arr);
    int currmax = 1;
    for (int i = 0; i < N; i++) {
      if (arr[i] >= currmax ){
        currmax++;
      }
    }
    out.println(currmax);
  }

}


import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class ProblemB {

  public static void main(String[] args) throws IOException {
    init();
    new ProblemB().run();
    out.flush();
    out.close();
  }

  static void init() throws IOException {
    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    in.ordinaryChars(0, 65535);
    in.wordChars(0, 65535);
    in.whitespaceChars(' ', ' ');
    in.whitespaceChars('\n', '\n');
    in.whitespaceChars('\r', '\r');
  }

  // класс для пар
  class Pair<L, R> {
    private final L X;
    private final R Y;

    public Pair(L X, R Y) {
      this.X = X;
      this.Y = Y;
    }

    public L getX() {
      return X;
    }

    public R getY() {
      return Y;
    }

    @Override
    public int hashCode() {
      return X.hashCode() ^ Y.hashCode();
    }

    @Override
    public boolean equals(Object o) {
      if (!(o instanceof Pair)) return false;
      Pair pairo = (Pair) o;
      return X.equals(pairo.getX()) && Y.equals(pairo.getY());
    }
  }

  static final long INFL = 200000000000000000L;
  static final int INF = 2000000000;
  static final boolean DEBUG = true;

  static StreamTokenizer in;
  static PrintWriter out;

  static void print(String s) {
    print(s, 0);
  }

  static void print(String s, int debug) {
    if (debug == 0 || DEBUG) {
      out.print(s);
    }
  }

  static void println(String s) {
    println(s, 0);
  }

  static void println(String s, int debug) {
    if (debug == 0 || DEBUG) {
      out.println(s);
    }
  }

  static void printArray(int[] arr) {
    println(Arrays.toString(arr));
  }

  static void printArray(char[] arr) {
    println(Arrays.toString(arr));
  }

  static void printArray(String[] arr) {
    println(Arrays.toString(arr));
  }

  static char[] inChars;
  static int inCharsInd;

  static String next() throws IOException {
    in.nextToken();
    return in.sval;
  }

  static char nextChar() throws IOException {
    while (inChars == null || inCharsInd >= inChars.length) {
      inChars = next().toCharArray();
      inCharsInd = 0;
    }
    return inChars[inCharsInd++];
  }

  static int nextInt() throws IOException {
    return Integer.valueOf(next());
  }

  static double nextDouble() throws IOException {
    return Double.valueOf(next());
  }

  static long nextLong() throws IOException {
    return Long.valueOf(next());
  }

  private void run() throws IOException {
    solve();
  }

  int K, L, M, N, P;

  private void solve() throws IOException {
    N = nextInt();
    ArrayList<Integer> arr = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      arr.add(nextInt());
    }
    Collections.shuffle(arr);
    Collections.sort(arr);
    int currmax = 1;
    for (Integer i : arr) {
      if (i >= currmax ){
        currmax++;
      }
    }
    out.println(currmax);
  }

}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;

import java.util.ArrayList;
public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        int cur=1;
        ArrayList<Integer> al = new ArrayList<Integer>();
        for(int i=0;i<n;i++)
            al.add(in.nextInt());
        for(int i=0;i<n;i++)
        {
            if(al.get(i)>=cur)
                cur++;
        }
        System.out.println(cur);
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;
public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        int cur=1;
        ArrayList<Integer> al = new ArrayList<Integer>();
        for(int i=0;i<n;i++)
        {
            al.add(in.nextInt());
        }
        Collections.sort(al);
        for(int i=0;i<n;i++)
        {
            if(al.get(i)>=cur)
                cur++;
        }
        System.out.println(cur);
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;
import java.util.Arrays;
public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        int a[] = new int[n];

        for(int i=0;i<n;i++)
        {
           a[i]= in.nextInt();
        }
        Arrays.sort(a);
        int cur=1;
        for(int i=0;i<n;i++)
        {
            if(a[i]>=cur)
                cur++;
        }
        System.out.println(cur);
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;
import java.util.Arrays;
public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        int a[] = new int[n];
        int cur=1;
        for(int i=0;i<n;i++)
        {
           a[i]= in.nextInt();
        }
        Arrays.sort(a);
        for(int i=0;i<n;i++)
        {
            if(a[i]>=cur)
                cur++;
        }
        System.out.println(cur);
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;
import java.util.Arrays;
public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        long a[] = new long[n];
        long cur=1;
        for(int i=0;i<n;i++)
        {
           a[i]= in.nextLong();
        }
        Arrays.sort(a);
        for(int i=0;i<n;i++)
        {
            if(a[i]>=cur)
                cur++;
        }
        System.out.println(cur);
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;

public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        int a[] = new int[n];
        int cur=1;
        for(int i=0;i<n;i++)
        {
           a[i]= in.nextInt();
        }

        for(int i=0;i<n;i++)
        {
            if(a[i]>=cur)
                cur++;
        }
        System.out.println(cur);
    }
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author samsung
 */
import java.util.Scanner;
import java.util.Arrays;
public class Aloya {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int  n = in.nextInt();
        int a[] = new int[n];

        for(int i=0;i<n;i++)
        {
           a[i]= in.nextInt();
        }
        Arrays.sort(a);
        int cur=1;
        for(int i=0;i<n;i++)
        {
            if(a[i]>=cur)
            {
                a[i]=cur;
                cur++;
            }
        }
        System.out.println(cur);
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import static java.lang.Math.max;
import static java.lang.Math.min;

import java.util.*;

import java.util.Scanner;
import java.io.PrintWriter;

public class TaskB {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }

        Arrays.sort(arr);

        int curr = 1;
        for (int i = 0; i < n; i++) {
            if (arr[i] >= curr) {
                curr += 1;
            }
        }

        out.println(curr);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import static java.lang.Math.max;
import static java.lang.Math.min;

import java.util.*;

import java.util.Scanner;
import java.io.PrintWriter;

public class TaskB {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    public void solve(int testNumber, Scanner in, PrintWriter out) {

        int n = in.nextInt();
//        int n = 100000;

//        int[] arr = new int[n];
        PriorityQueue<Integer> pq = new PriorityQueue<>();

        for (int i = 0; i < n; i++) {
//            arr[i] = in.nextInt();
            pq.add(in.nextInt());
        }

        int curr = 1;
        for (int i = 0; i < n; i++) {
            if (pq.poll() >= curr) {
                curr += 1;
            }
        }

        out.println(curr);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import static java.lang.Math.max;
import static java.lang.Math.min;

import java.util.*;

import java.util.Scanner;
import java.io.PrintWriter;

public class TaskB {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {

        int n = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }

        Arrays.sort(arr);

        int curr = 1;
        for (int i = 0; i < n; i++) {
            if (arr[i] > curr) {
                curr += 1;
            }
        }

        out.println(curr+1);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}


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

public class Add_Candies_683 {

	static int mod = (int) (1e9 + 7);

	public static void main(String[] args) throws java.lang.Exception {
		long start = System.nanoTime(); // Program Start
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		while (t-- > 0) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int n=Integer.parseInt(st.nextToken());
			System.out.println(n);
			for(int i=1; i<=n; i++) System.out.print(i+" ");
			System.out.println();
		}
		long end = System.nanoTime(); // Program End
		System.err.println("Time taken: " + (end - start) / 1000000 + " ms");
	}

	static class CP {

		static boolean isPrime(long n) {
			if (n <= 1)
				return false;
			if (n == 2 || n == 3)
				return true;
			if (n % 2 == 0 || n % 3 == 0)
				return false;
			for (int i = 5; i * i <= n; i += 6) {
				if (n % i == 0 || n % (i + 2) == 0)
					return false;
			}
			return true;
		}

		static long binary_Expo(long a, long b) { // calculating a^b
			long res = 1;
			while (b != 0) {
				if ((b & 1) == 1) {
					res *= a;
					--b;
				}
				a *= a;
				b /= 2;
			}
			return res;
		}

		static long Modular_Expo(long a, long b) {
			long res = 1;
			while (b != 0) {
				if ((b & 1) == 1) {
					res = (res * a) % mod;
					--b;
				}
				a = (a * a) % mod;
				b /= 2;
			}
			return res;
		}

		static int i_gcd(int a, int b) {// iterative way to calculate gcd.
			while (true) {
				if (b == 0)
					return a;
				int c = a;
				a = b;
				b = c % b;
			}
		}

		static long gcd(long a, long b) {// here b is the remainder
			if (b == 0)
				return a; //because each time b will divide a.
			return gcd(b, a % b);
		}

		static long ceil_div(long a, long b) { // a numerator b denominator
			return (a + b - 1) / b;
		}

		static int getIthBitFromInt(int bits, int i) {
			return (bits >> (i - 1)) & 1;
		}

		static int upper_Bound(int a[], int x) {//closest to the left+1
			int l = -1, r = a.length;
			while (l + 1 < r) {
				int m = (l + r) >>> 1;
				if (a[m] <= x)
					l = m;
				else
					r = m;
			}
			return l + 1;
		}

		static int lower_Bound(int a[], int x) {//closest to the right
			int l = -1, r = a.length;
			while (l + 1 < r) {
				int m = (l + r) >>> 1;
				if (a[m] >= x)
					r = m;
				else
					l = m;
			}
			return r;
		}

		static void sort(int a[]) {//heap sort
			PriorityQueue<Integer> q = new PriorityQueue<>();
			for (int i = 0; i < a.length; i++)
				q.add(a[i]);
			for (int i = 0; i < a.length; i++)
				a[i] = q.poll();
		}

		static void countSort(int arr[], int n, int exp) {
			int output[] = new int[n]; // output array
			int i;
			int count[] = new int[10];
			Arrays.fill(count, 0);

			// Store count of occurrences in count[]
			for (i = 0; i < n; i++)
				count[(arr[i] / exp) % 10]++;

			// Change count[i] so that count[i] now contains
			// actual position of this digit in output[]
			for (i = 1; i < 10; i++)
				count[i] += count[i - 1];

			// Build the output array
			for (i = n - 1; i >= 0; i--) {
				output[count[(arr[i] / exp) % 10] - 1] = arr[i];
				count[(arr[i] / exp) % 10]--;
			}

			// Copy the output array to arr[], so that arr[] now
			// contains sorted numbers according to curent digit
			for (i = 0; i < n; i++)
				arr[i] = output[i];
		}

		// The main function to that sorts arr[] of size n using
		// Radix Sort
		static void radixsort(int arr[], int n) {
			// Find the maximum number to know number of digits
			int m = getMax(arr, n);

			// Do counting sort for every digit. Note that
			// instead of passing digit number, exp is passed.
			// exp is 10^i where i is current digit number
			for (int exp = 1; m / exp > 0; exp *= 10)
				countSort(arr, n, exp);
		}

		static int getMax(int arr[], int n) {
			int mx = arr[0];
			for (int i = 1; i < n; i++)
				if (arr[i] > mx)
					mx = arr[i];
			return mx;
		}

	}
}


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

public class Add_Candies_683 {

	static int mod = (int) (1e9 + 7);

	public static void main(String[] args) throws java.lang.Exception {
		long start = System.nanoTime(); // Program Start
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		while (t-- > 0) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int n=Integer.parseInt(st.nextToken());
			System.out.println(n-1);
			for(int i=n-1; i>=1; i--) System.out.print(i+" ");
			System.out.println();
		}
		long end = System.nanoTime(); // Program End
		System.err.println("Time taken: " + (end - start) / 1000000 + " ms");
	}

	static class CP {

		static boolean isPrime(long n) {
			if (n <= 1)
				return false;
			if (n == 2 || n == 3)
				return true;
			if (n % 2 == 0 || n % 3 == 0)
				return false;
			for (int i = 5; i * i <= n; i += 6) {
				if (n % i == 0 || n % (i + 2) == 0)
					return false;
			}
			return true;
		}

		static long binary_Expo(long a, long b) { // calculating a^b
			long res = 1;
			while (b != 0) {
				if ((b & 1) == 1) {
					res *= a;
					--b;
				}
				a *= a;
				b /= 2;
			}
			return res;
		}

		static long Modular_Expo(long a, long b) {
			long res = 1;
			while (b != 0) {
				if ((b & 1) == 1) {
					res = (res * a) % mod;
					--b;
				}
				a = (a * a) % mod;
				b /= 2;
			}
			return res;
		}

		static int i_gcd(int a, int b) {// iterative way to calculate gcd.
			while (true) {
				if (b == 0)
					return a;
				int c = a;
				a = b;
				b = c % b;
			}
		}

		static long gcd(long a, long b) {// here b is the remainder
			if (b == 0)
				return a; //because each time b will divide a.
			return gcd(b, a % b);
		}

		static long ceil_div(long a, long b) { // a numerator b denominator
			return (a + b - 1) / b;
		}

		static int getIthBitFromInt(int bits, int i) {
			return (bits >> (i - 1)) & 1;
		}

		static int upper_Bound(int a[], int x) {//closest to the left+1
			int l = -1, r = a.length;
			while (l + 1 < r) {
				int m = (l + r) >>> 1;
				if (a[m] <= x)
					l = m;
				else
					r = m;
			}
			return l + 1;
		}

		static int lower_Bound(int a[], int x) {//closest to the right
			int l = -1, r = a.length;
			while (l + 1 < r) {
				int m = (l + r) >>> 1;
				if (a[m] >= x)
					r = m;
				else
					l = m;
			}
			return r;
		}

		static void sort(int a[]) {//heap sort
			PriorityQueue<Integer> q = new PriorityQueue<>();
			for (int i = 0; i < a.length; i++)
				q.add(a[i]);
			for (int i = 0; i < a.length; i++)
				a[i] = q.poll();
		}

		static void countSort(int arr[], int n, int exp) {
			int output[] = new int[n]; // output array
			int i;
			int count[] = new int[10];
			Arrays.fill(count, 0);

			// Store count of occurrences in count[]
			for (i = 0; i < n; i++)
				count[(arr[i] / exp) % 10]++;

			// Change count[i] so that count[i] now contains
			// actual position of this digit in output[]
			for (i = 1; i < 10; i++)
				count[i] += count[i - 1];

			// Build the output array
			for (i = n - 1; i >= 0; i--) {
				output[count[(arr[i] / exp) % 10] - 1] = arr[i];
				count[(arr[i] / exp) % 10]--;
			}

			// Copy the output array to arr[], so that arr[] now
			// contains sorted numbers according to curent digit
			for (i = 0; i < n; i++)
				arr[i] = output[i];
		}

		// The main function to that sorts arr[] of size n using
		// Radix Sort
		static void radixsort(int arr[], int n) {
			// Find the maximum number to know number of digits
			int m = getMax(arr, n);

			// Do counting sort for every digit. Note that
			// instead of passing digit number, exp is passed.
			// exp is 10^i where i is current digit number
			for (int exp = 1; m / exp > 0; exp *= 10)
				countSort(arr, n, exp);
		}

		static int getMax(int arr[], int n) {
			int mx = arr[0];
			for (int i = 1; i < n; i++)
				if (arr[i] > mx)
					mx = arr[i];
			return mx;
		}

	}
}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        for(int i=0;i<t;i++){
            int n=sc.nextInt();
            System.out.println(n);
            for(int j=1;j<=n;j++){
                System.out.print(j +" ");
            }
        }
    }
}


import java.util.Scanner;

public class A1447 {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int noTests = scanner.nextInt();
    for (int testId = 1; testId <= noTests; testId++) {
      int arrSize = scanner.nextInt();
      int arrSum = (arrSize + 1) * arrSize / 2;
      int aveNum = 0;
      int sumTemp = 0;
      int noOperations = 0;
      for (int index = 1; index <= 100; index++) {
        sumTemp += index;
        if ((arrSum + (arrSize-1)*sumTemp) % arrSize == 0) {
          aveNum = (arrSum + (arrSize-1)*sumTemp) / arrSize;
          noOperations = index;
          break;
        }
      }
      System.out.println(noOperations);
      int index = 1;
      while (index <= noOperations) {
        for (int stt = 1; stt <= arrSize; stt++){
          if (stt + (noOperations + 1) * noOperations / 2 - aveNum == index) {
            System.out.print(stt + " ");
            break;
          }
        }
        index++;
      }
      System.out.println();
    }
    scanner.close();
  }
}


import java.util.Scanner;

public class A1447 {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int noTests = scanner.nextInt();
    for (int testId = 1; testId <= noTests; testId++) {
      int arrSize = scanner.nextInt();
      //System.out.println("size " + arrSize);
      int arrSum = (arrSize + 1) * arrSize / 2;
      int aveNum = 0;
      int sumTemp = 0;
      int noOperations = 0;
      for (int index = 1; index <= 1000; index++) {
        sumTemp += index;
        if ((arrSum + (arrSize-1)*sumTemp) % arrSize == 0) {
          if (1 + sumTemp - (arrSum + (arrSize-1)*sumTemp) / arrSize == 0 || 1 + sumTemp - (arrSum + (arrSize-1)*sumTemp) / arrSize ==1 ) {
            aveNum = (arrSum + (arrSize-1)*sumTemp) / arrSize;
            noOperations = index;
            //System.out.println("ave " + aveNum + " Operation: " + noOperations);
            break;
          }
        }
      }
      System.out.println(noOperations);
      int index = 1;
      while (index <= noOperations) {
        for (int stt = 1; stt <= arrSize; stt++){
          if (stt + (noOperations + 1) * noOperations / 2 - aveNum == index) {
            System.out.print(stt + " ");
            break;
          }
        }
        index++;
      }
      System.out.println();
    }
    scanner.close();

  }
}


import java.util.Scanner;

public class A1447 {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int noTests = scanner.nextInt();
    for (int testId = 1; testId <= noTests; testId++) {
      int arrSize = scanner.nextInt();
      int arrSum = (arrSize + 1) * arrSize / 2;
      int aveNum = 0;
      int sumTemp = 0;
      int noOperations = 0;
      for (int index = 1; index <= 100; index++) {
        sumTemp += index;
        if ((arrSum + (arrSize-1)*sumTemp) % arrSize == 0) {
          aveNum = (arrSum + (arrSize-1)*sumTemp) / arrSize;
          noOperations = index;
          break;
        }
      }
      int index = 1;
      while (index <= noOperations) {
        for (int stt = 1; stt <= arrSize; stt++){
          if (stt + (noOperations + 1) * noOperations / 2 - aveNum == index) {
            System.out.print(stt + " ");
            break;
          }
        }
        index++;
      }
      System.out.println();
    }
    scanner.close();

  }
}


import java.util.Scanner;

public class A1447 {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int noTests = scanner.nextInt();
    for (int testId = 1; testId <= noTests; testId++) {
      int arrSize = scanner.nextInt();
      //System.out.println(arrSize);
      int arrSum = (arrSize + 1) * arrSize / 2;
      int aveNum = 0;
      int sumTemp = 0;
      int noOperations = 0;
      for (int index = 1; index <= 100; index++) {
        sumTemp += index;
        if ((arrSum + (arrSize-1)*sumTemp) % arrSize == 0) {
          aveNum = (arrSum + (arrSize-1)*sumTemp) / arrSize;
          noOperations = index;
          //System.out.println(aveNum + " " + noOperations);
          break;
        }
      }
      System.out.println(noOperations);
      int index = 1;
      while (index <= noOperations) {
        for (int stt = 1; stt <= arrSize; stt++){
          if (stt + (noOperations + 1) * noOperations / 2 - aveNum == index) {
            System.out.print(stt + " ");
            break;
          }
        }
        index++;
      }
      System.out.println();
    }
    scanner.close();

  }
}


import java.util.Scanner;

public class A1447 {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int noTests = scanner.nextInt();
    for (int testId = 1; testId <= noTests; testId++) {
      int arrSize = scanner.nextInt();
      int arrSum = (arrSize + 1) * arrSize / 2;
      int aveNum = 0;
      int sumTemp = 0;
      int noOperations = 0;
      for (int index = 1; index <= 100; index++) {
        sumTemp += index;
        if ((arrSum + (arrSize-1)*sumTemp) % arrSize == 0) {
          aveNum = (arrSum + (arrSize-1)*sumTemp) / arrSize;
          noOperations = index;
          //System.out.println(aveNum + " " + noOperations);
          break;
        }
      }
      int index = 1;
      while (index <= noOperations) {
        for (int stt = 1; stt <= arrSize; stt++){
          if (stt + (noOperations + 1) * noOperations / 2 - aveNum == index) {
            System.out.print(stt + " ");
            break;
          }
        }
        index++;
      }
      System.out.println();
    }
    scanner.close();

  }
}


import java.util.ArrayList;
import java.util.Scanner;

public class AddCandies {

	public static boolean checkEqual(int[] arr) {
		int n = arr.length;
		boolean flag = true;

		for(int i=0; i<n-1; i++) {
			if(arr[i] != arr[i+1]) {
				flag = false;
				break;
			}
		}

		return flag;
	}

	public static int findIndex(int[] arr) {
		int n = arr.length;
		int max = arr[0];

		int index = 0;

		for(int i=1; i<n; i++) {
			if(max < arr[i]) {
				max = arr[i];
				index = i;
			}
		}

		return index;
	}

	public static int findMin(int[] arr) {
		int n = arr.length;
		int min = arr[0];

		for(int i=1; i<n; i++) {
			min = Math.min(min, arr[i]);
		}

		return min;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-- > 0) {
			int n = sc.nextInt();

			int[] arr = new int[n];

			for(int i=0; i<n; i++)	arr[i] = i+1;

			ArrayList<Integer> list = new ArrayList<>();

			int count = 0;

			while(!checkEqual(arr)) {
				int index = findIndex(arr);

				int minVal = findMin(arr);

				int dif = (arr[index] - minVal);

				for(int i=0; i<n; i++) {
					if(i == index)	continue;
					else {
						arr[i] += dif;
						list.add(index+1);
					}
				}

				count += n - 1;
			}

			System.out.println(count);

			for(int val : list) {
				System.out.print(val + " ");
			}

			System.out.println();
		}

		sc.close();
	}

}


import java.util.ArrayList;
import java.util.Scanner;

public class AddCandies {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-- > 0) {
			int n = sc.nextInt();

			System.out.println(n);

			for(int i=0; i<n; i++) {
				System.out.print(i+1 + " ");
			}

			System.out.println();
		}

		sc.close();
	}

}


import java.util.ArrayList;
import java.util.Scanner;

public class AddCandies {

	public static boolean checkEqual(int[] arr) {
		int n = arr.length;
		boolean flag = true;

		for(int i=0; i<n-1; i++) {
			if(arr[i] != arr[i+1]) {
				flag = false;
				break;
			}
		}

		return flag;
	}

	public static int findIndex(int[] arr) {
		int n = arr.length;
		int max = arr[0];

		int index = 0;

		for(int i=1; i<n; i++) {
			if(max < arr[i]) {
				max = arr[i];
				index = i;
			}
		}

		return index;
	}

	public static int findMin(int[] arr) {
		int n = arr.length;
		int min = arr[0];

		for(int i=1; i<n; i++) {
			min = Math.min(min, arr[i]);
		}

		return min;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int t = sc.nextInt();

		while(t-- > 0) {
			int n = sc.nextInt();

			int[] arr = new int[n];

			for(int i=0; i<n; i++)	arr[i] = i+1;

			ArrayList<Integer> list = new ArrayList<>();

			int count = 0;

			while(!checkEqual(arr)) {
				int index = findIndex(arr);
				list.add(index+1);

				int minVal = findMin(arr);

				int dif = (arr[index] - minVal);

				for(int i=0; i<n; i++) {
					if(i == index)	continue;
					else {
						arr[i] += dif;
					}
				}

				count += 1;
			}

			System.out.println(count);

			for(int val : list) {
				System.out.print(val + " ");
			}

			System.out.println();
		}

		sc.close();
	}

}


import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int T = Integer.parseInt(br.readLine());
        while (T-->0){
            int n = Integer.parseInt(br.readLine());
            System.out.println(n);
            for(int i=1;i<=n;i++){
                System.out.print(i+" ");
            }
            System.out.println();
        }
    }

}


import java.util.*;
public class asd
{
    static long y=Integer.MIN_VALUE;
    public static void main(String argsg[])
         {
                  Scanner s=new Scanner(System.in);
                  int t=s.nextInt();
                  while(t-->0)
                  {
                  int n=s.nextInt();
                 for(int i=1;i<=n;i++)
                     System.out.print(i+" ");
                 System.out.println();
                  }
         }
}


import java.util.*;
public class asd
{
    static long y=Integer.MIN_VALUE;
    public static void main(String argsg[])
         {
                  Scanner s=new Scanner(System.in);
                  int t=s.nextInt();
                  while(t-->0)
                  {
                  int n=s.nextInt();
                  System.out.println(n);
                 for(int i=1;i<=n;i++)
                     System.out.print(i+" ");
                 System.out.println();
                  }
         }
}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

public class Main
{
    public static void main(String[] args)
    {

        Scanner in=new Scanner(System.in);
        int t=in.nextInt();
        while(t>0)
        {
            t--;
            int n=in.nextInt();
            int m=in.nextInt();
            int[][] a=new int[n][m];
            int c=0;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    a[i][j]=in.nextInt();
                    if(a[i][j]<0)
                        c++;
                }
            }
            int sum=0;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    sum+=Math.abs(a[i][j]);
                }
            }
            if((c&1)==0)
            {

                System.out.println(sum);
            }
            else
            {
                int min=Integer.MAX_VALUE;
                for(int i=0;i<n;i++)
                {
                    for(int j=0;j<m;j++)
                    {
                        min=Math.min(min,Math.abs(a[i][j]));
                    }
                }
                System.out.println((sum-2*min));
            }

        }
    }
}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

public class Main
{
    public static void main(String[] args)
    {

        Scanner in=new Scanner(System.in);
        int t=in.nextInt();
        while(t>0)
        {
            t--;
            int n=in.nextInt();
            System.out.println(n-1);
            for(int i=1;i<=n-1;i++)
                System.out.print((i+1)+" ");
            System.out.println();
        }
    }
}


import java.util.*;

public class AddCandies_A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0) {
			int n = sc.nextInt();
			System.out.println(n);
			for(int i = 1; i<=n; i++) {
				System.out.print(i+" ");
			}
			System.out.println();
		}
	}

}


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

public class Main {
	static BufferedReader br;
	static PrintWriter pr;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}
		return ans;
	}
	static long[] splitL() throws IOException
	{
		String[] cmd=br.readLine().split(" ");
		long[] ans=new long[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Long.valueOf(cmd[i]);
		}
		return ans;
	}
	static int sum(long n)
	{
		int ans=0;
		while(n!=0)
		{
			ans=ans+(int)(n%10);
			n=n/10;
		}
		return ans;
	}
	static long gcd(long x,long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		if(x>y)
			return gcd(x%y,y);
		else
			return gcd(x,y%x);
	}
	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		br=new BufferedReader(new InputStreamReader(System.in));
		pr=new PrintWriter(new OutputStreamWriter(System.out));
		int cases=cin();
		while(cases!=0)
		{
			cases--;
			int n=cin();
			System.out.println(n);
			for(int i=1;i<=n;i++)
			{
				System.out.print(i+" ");
			}
			System.out.println();
		}
	}
}


//package com.company;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int t = Integer.parseInt(br.readLine());
        while (t-->0){
            int n = Integer.parseInt(br.readLine());
            pw.println(n);
            for(int i=0;i<n;i++) pw.print(i+1+" ");
        }
        pw.flush();
        pw.close();
    }
}


//package com.company;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        int t = Integer.parseInt(br.readLine());
        while (t-->0){
            int n = Integer.parseInt(br.readLine());
            if(n%2==0){
                pw.println(n-1);
                for(int i=0;i<n-1;i++) pw.print(i+2+" ");
            }else{
                pw.println(n);
                for(int i=0;i<n;i++) pw.print(i+1+" ");
            }
            pw.println();
        }
        pw.flush();
        pw.close();
    }
}


import java.util.*;
import java.lang.*;

public class A {

	static Scanner sc;

	public static void solve() {
		int n = sc.nextInt();
		int[] nums = new int[n];
		for(int i = 0; i < n; i++)
			nums[i] = i+1;

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(i == j) continue;
				nums[j] += i+1;
				sb.append(nums[j] + " ");
			}
		}
		System.out.println(sb.length() / 2);
		System.out.println(sb.toString());
	}

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int n = sc.nextInt();

		for(int i = 0; i < n; i++) {
			solve();
		}

		sc.close();
	}

}


import java.util.*;
import java.lang.*;

public class A {

	static Scanner sc;

	public static void solve() {
		int n = sc.nextInt();
		int[] nums = new int[n];
		for(int i = 0; i < n; i++)
			nums[i] = i+1;

		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++) {
			sb.append((n+1) - nums[i] + " ");
		}
		System.out.println(sb.length() / 2);
		System.out.println(sb.toString());
	}

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int n = sc.nextInt();

		for(int i = 0; i < n; i++) {
			solve();
		}

		sc.close();
	}

}


import java.util.*;
import java.lang.*;

// RTL here but let's test the concept
public class A {

	static Scanner sc;

	public static void solve() {
		int n = sc.nextInt();

		System.out.println(n-1);
		for(int i = 0; i < n-1; i++)
			System.out.print(i+2 + " ");
		System.out.println();

	}

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int n = sc.nextInt();

		for(int i = 0; i < n; i++) {
			solve();
		}

		sc.close();
	}

}


import java.util.*;
import java.lang.*;

// RTL here but let's test the concept
public class A {

	static Scanner sc;

	public static void solve() {
		int n = sc.nextInt();
		int[] nums = new int[n];
		for(int i = 0; i < n; i++)
			nums[i] = i+1;

		check(nums,0, 1, new ArrayList<Integer>());
	}

	static boolean check(int[] nums,int index, int val, List<Integer> skips) {
		boolean equals = true;
		if(val > nums.length) return false;

		for(int i = 0; i < nums.length - 1; i++) {
			if(nums[i] != nums[i+1]) equals = false;
		}

		if(equals) {
			System.out.println(skips.size());
			for(int c: skips)
				System.out.print((c+1) + " ");
			System.out.println();
			return true;
		}
		for(int i = 0; i < nums.length; i++) {
			for(int j = 0; j < nums.length; j++) {
				if(i != j) {
					nums[j] += val;
				}
			}
			skips.add(i);
			if(check(nums,i, val+1, skips)) return true;
			skips.remove(skips.size() -1);
			for(int j = 0; j < nums.length; j++) {
				if(i != j) {
					nums[j] -= val;
				}
			}
		}

		return false;
	}

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		int n = sc.nextInt();

		for(int i = 0; i < n; i++) {
			solve();
		}

		sc.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Scratch {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        int t = Integer.parseInt(br.readLine());
        while(t-->0) {
            int n = Integer.parseInt(br.readLine());
            int[] arr = new int[n];
            for(int i = n-1;i>=0;i--) {
                arr[i] = i + 1;
            }
            System.out.println(n-1);
            for(int i = n-1;i>=2;i--){
                System.out.print(i+" ");
            }
            System.out.println();

        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Scratch {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        int t = Integer.parseInt(br.readLine());
        while(t-->0) {
            int n = Integer.parseInt(br.readLine());
            int[] arr = new int[n];
            for(int i = n-1;i>=0;i--) {
                arr[i] = i + 1;
            }
            System.out.println(n-1);
            for(int i = n-1;i>=1;i--){
                System.out.print(i+" ");
            }
            System.out.println();

        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Scratch {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        int t = Integer.parseInt(br.readLine());
        while(t-->0) {
            int n = Integer.parseInt(br.readLine());
            int[] arr = new int[n];
            for(int i = n-1;i>=0;i--) {
                arr[i] = i + 1;
            }
            System.out.println(n);
            for(int i = 1;i<=n;i++){
                System.out.print(i+" ");
            }
            System.out.println();

        }
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Scratch {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        int t = Integer.parseInt(br.readLine());
        while(t-->0) {
            int n = Integer.parseInt(br.readLine());
            int[] arr = new int[n];
            for(int i = n-1;i>=0;i--) {
                arr[i] = i + 1;
            }
            System.out.println(n-1);
            for(int i = 1;i<=n;i++){
                System.out.print(i+" ");
            }
            System.out.println();

        }
    }

}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class Main
{
	static class Reader
	{
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader()
		{
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException
		{
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException
		{
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1)
			{
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException
		{
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
			{
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException
		{
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException
		{
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');

			if (c == '.')
			{
				while ((c = read()) >= '0' && c <= '9')
				{
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException
		{
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException
		{
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException
		{
			if (din == null)
				return;
			din.close();
		}
	}

	public static void main(String[] args) throws IOException
	{
		Reader in=new Reader();
		PrintWriter pw = new PrintWriter(System.out);
	    int t=in.nextInt();
	    while(t>0){
	        int n=in.nextInt();
	        if(n==2){
	            pw.println(n-1);
	            pw.println(n);
	        }else{
	        pw.println(n-1);
	        for(int i=n-2;i>=0;i--) pw.print(i+1+" ");
	        }
	        pw.flush();
	        t--;
	    }
	}
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class Main
{
	static class Reader
	{
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader()
		{
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException
		{
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException
		{
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1)
			{
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException
		{
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
			{
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException
		{
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException
		{
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			}
			while ((c = read()) >= '0' && c <= '9');

			if (c == '.')
			{
				while ((c = read()) >= '0' && c <= '9')
				{
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException
		{
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException
		{
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException
		{
			if (din == null)
				return;
			din.close();
		}
	}

	public static void main(String[] args) throws IOException
	{
		Reader in=new Reader();
		PrintWriter pw = new PrintWriter(System.out);
	    int t=in.nextInt();
	    while(t>0){
	        int n=in.nextInt();
	        if(n==2){
	            pw.println(n-1);
	            pw.println(n);
	        }else{
	        pw.println(n);
	        for(int i=1;i<=n;i++) pw.print(i+" ");
	        pw.println();
	        }
	        pw.flush();
	        t--;
	    }
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static long gcd(long a, long b){
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    static long lcm(long a, long b)  {
        return (a*b)/gcd(a, b);
    }
    public static void sortbyColumn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>() {

          @Override

          public int compare(final int[] entry1,
                             final int[] entry2) {

            if (entry1[col] > entry2[col])
                return 1;
            else
                return -1;
          }
        });
    }
    static long func(long a[],long size,int s){
        long max1=a[s];
        long maxc=a[s];
        for(int i=s+1;i<size;i++){
            maxc=Math.max(a[i],maxc+a[i]);
            max1=Math.max(maxc,max1);
        }
        return max1;
    }
    public static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        public U x;
        public V y;

        public Pair(U x, V y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x == null ? 0 : x.hashCode() * 31) + (y == null ? 0 : y.hashCode());
        }

        public boolean equals(Object o) {
            if (this == o)
                return true;
            if (o == null || getClass() != o.getClass())
                return false;
            Pair<U, V> p = (Pair<U, V>) o;
            return (x == null ? p.x == null : x.equals(p.x)) && (y == null ? p.y == null : y.equals(p.y));
        }

        public int compareTo(Pair<U, V> b) {
            int cmpU = x.compareTo(b.x);
            return cmpU != 0 ? cmpU : y.compareTo(b.y);
        }

        public String toString() {
            return String.format("(%s, %s)", x.toString(), y.toString());
        }

    }
    static class MultiSet<U extends Comparable<U>> {
        public int sz = 0;
        public TreeMap<U, Integer> t;

        public MultiSet() {
            t = new TreeMap<>();
        }

        public void add(U x) {
            t.put(x, t.getOrDefault(x, 0) + 1);
            sz++;
        }

        public void remove(U x) {
            if (t.get(x) == 1) t.remove(x);
            else t.put(x, t.get(x) - 1);
            sz--;
        }

    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    //static LinkedList<Integer> li;
    //static LinkedList<Integer> ans;
    static int ans1=0,ans2=0,n,m;
    static long dist[];
    static int visited[][],mat[][];
    static ArrayList<Integer> adj[];
    static int dp[][][];
    static int R,G,B;

    public static void main(String args[]){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int t,i,j,k;

        t=in.nextInt();
        //t=1;
        while(t-->0){
            //int n,m;
            n=in.nextInt();
            int arr[]=new int[n];
            for(i=0;i<n;i++){
                arr[i]=i+1;
            }
            w.println(n);

            for(i=0;i<n;i++){
                w.print(arr[i]+" ");
            }
            w.println();

        }
        w.close();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static long gcd(long a, long b){
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    static long lcm(long a, long b)  {
        return (a*b)/gcd(a, b);
    }
    public static void sortbyColumn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>() {

          @Override

          public int compare(final int[] entry1,
                             final int[] entry2) {

            if (entry1[col] > entry2[col])
                return 1;
            else
                return -1;
          }
        });
    }
    static long func(long a[],long size,int s){
        long max1=a[s];
        long maxc=a[s];
        for(int i=s+1;i<size;i++){
            maxc=Math.max(a[i],maxc+a[i]);
            max1=Math.max(maxc,max1);
        }
        return max1;
    }
    public static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        public U x;
        public V y;

        public Pair(U x, V y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x == null ? 0 : x.hashCode() * 31) + (y == null ? 0 : y.hashCode());
        }

        public boolean equals(Object o) {
            if (this == o)
                return true;
            if (o == null || getClass() != o.getClass())
                return false;
            Pair<U, V> p = (Pair<U, V>) o;
            return (x == null ? p.x == null : x.equals(p.x)) && (y == null ? p.y == null : y.equals(p.y));
        }

        public int compareTo(Pair<U, V> b) {
            int cmpU = x.compareTo(b.x);
            return cmpU != 0 ? cmpU : y.compareTo(b.y);
        }

        public String toString() {
            return String.format("(%s, %s)", x.toString(), y.toString());
        }

    }
    static class MultiSet<U extends Comparable<U>> {
        public int sz = 0;
        public TreeMap<U, Integer> t;

        public MultiSet() {
            t = new TreeMap<>();
        }

        public void add(U x) {
            t.put(x, t.getOrDefault(x, 0) + 1);
            sz++;
        }

        public void remove(U x) {
            if (t.get(x) == 1) t.remove(x);
            else t.put(x, t.get(x) - 1);
            sz--;
        }

    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    //static LinkedList<Integer> li;
    //static LinkedList<Integer> ans;
    static int ans1=0,ans2=0,n,m;
    static long dist[];
    static int visited[][],mat[][];
    static ArrayList<Integer> adj[];
    static int dp[][][];
    static int R,G,B;

    public static void main(String args[]){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int t,i,j,k;

        t=in.nextInt();
        //t=1;
        while(t-->0){
            //int n,m;
            n=in.nextInt();
            int arr[]=new int[n];
            for(i=0;i<n;i++){
                arr[i]=i+1;
            }

            for(i=0;i<n;i++){
                w.print(arr[i]+" ");
            }
            w.println();

        }
        w.close();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.util.*;
import java.io.*;
import java.lang.*;
public class Main{
    public static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static long gcd(long a, long b){
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    static long lcm(long a, long b)  {
        return (a*b)/gcd(a, b);
    }
    public static void sortbyColumn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>() {

          @Override

          public int compare(final int[] entry1,
                             final int[] entry2) {

            if (entry1[col] > entry2[col])
                return 1;
            else
                return -1;
          }
        });
    }
    static long func(long a[],long size,int s){
        long max1=a[s];
        long maxc=a[s];
        for(int i=s+1;i<size;i++){
            maxc=Math.max(a[i],maxc+a[i]);
            max1=Math.max(maxc,max1);
        }
        return max1;
    }
    public static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        public U x;
        public V y;

        public Pair(U x, V y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x == null ? 0 : x.hashCode() * 31) + (y == null ? 0 : y.hashCode());
        }

        public boolean equals(Object o) {
            if (this == o)
                return true;
            if (o == null || getClass() != o.getClass())
                return false;
            Pair<U, V> p = (Pair<U, V>) o;
            return (x == null ? p.x == null : x.equals(p.x)) && (y == null ? p.y == null : y.equals(p.y));
        }

        public int compareTo(Pair<U, V> b) {
            int cmpU = x.compareTo(b.x);
            return cmpU != 0 ? cmpU : y.compareTo(b.y);
        }

        public String toString() {
            return String.format("(%s, %s)", x.toString(), y.toString());
        }

    }
    static class MultiSet<U extends Comparable<U>> {
        public int sz = 0;
        public TreeMap<U, Integer> t;

        public MultiSet() {
            t = new TreeMap<>();
        }

        public void add(U x) {
            t.put(x, t.getOrDefault(x, 0) + 1);
            sz++;
        }

        public void remove(U x) {
            if (t.get(x) == 1) t.remove(x);
            else t.put(x, t.get(x) - 1);
            sz--;
        }

    }
    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }
    //static LinkedList<Integer> li;
    //static LinkedList<Integer> ans;
    static int ans1=0,ans2=0,n,m;
    static long dist[];
    static int visited[][],mat[][];
    static ArrayList<Integer> adj[];
    static int dp[][][];
    static int R,G,B;

    public static void main(String args[]){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter w = new PrintWriter(outputStream);
        int t,i,j,k;

        t=in.nextInt();
        //t=1;
        while(t-->0){
            //int n,m;
            n=in.nextInt();
            int arr[]=new int[2*n-1];
            for(i=0;i<n;i++){
                arr[i]=n;
            }

            for(i=n;i<2*n-1;i++){
                arr[i]=i-n+1;
            }
            for(i=0;i<2*n-1;i++){
                w.print(arr[i]+" ");
            }
            w.println();

        }
        w.close();
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	//static int [] arr;
	//static boolean prime[] = new boolean[1000];
	//static List<Long> al = new ArrayList<>();
	//static int l;
	//static String s; static StringBuilder sb;
	//static HashSet<L> hs;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int t = sc.nextInt();
        //int t = 1;\
        // sieve(600);
        while (t-->0) {
        		int n = sc.nextInt();
        		out.println(n);
        		for(int i = 1 ; i <= n ; i++)
        			out.print(i + " ");
        		out.println();
        	}

        out.close();
    }

    }

//    static void findsubsequences(String s, String ans){
//    	if (s.length() == 0) {
//    		if(ans!="")
//    			if(ans.length()!=l)
//    			al.add(Long.parseLong(ans));
//    		return;
//	}
//
//		// We add adding 1st character in string
//		findsubsequences(s.substring(1), ans + s.charAt(0));
//
//		// Not adding first character of the string
//		// because the concept of subsequence either
//		// character will present or not
//		findsubsequences(s.substring(1), ans);
//}

//    static void sieve(int n)
//    {
//        // Create a boolean array "prime[0..n]" and initialize
//        // all entries it as true. A value in prime[i] will
//        // finally be false if i is Not a prime, else true.
//
//        for(int i=0;i<n;i++)
//            prime[i] = true;
//
//        for(int p = 2; p*p <=n; p++)
//        {
//            // If prime[p] is not changed, then it is a prime
//            if(prime[p] == true)
//            {
//                // Update all multiples of p
//                for(int i = p*p; i <= n; i += p)
//                    prime[i] = false;
//            }
//        }
//    }
 //Print all prime numbers
//        for(int i = 2; i <= n; i++)
//        {
//            if(prime[i] == true)
//                System.out.print(i + " ");
//        }

	class Pair  implements Comparable <Pair>{
		int a ;
		int b ;
		public Pair(int a , int b) {
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			return this.a-o.a;
		}
		public String toString() {
			return "( " + this.a + " , " + this.b + " )\n";
		}

	}

	 class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public int[][] nextInt2DArr(int l, int w) throws IOException {
			int [][] arr = new int[l][w];
			for(int i = 0 ; i < l ; i++)
				for(int j = 0 ; j<w ; j++)
				arr[i][j]= Integer.parseInt(next());
			return arr;
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public int[] nextIntArr(int length) throws IOException {
			int[] arr = new int[length];
			for(int i = 0 ; i < length ; i++)
				arr[i] = Integer.parseInt(next());
			return arr;
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	 }


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	//static int [] arr;
	//static boolean prime[] = new boolean[1000];
	//static List<Long> al = new ArrayList<>();
	//static int l;
	//static String s; static StringBuilder sb;
	//static HashSet<L> hs;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int t = sc.nextInt();
        //int t = 1;\
        // sieve(600);
        while (t-->0) {
        		int n = sc.nextInt();
        		int x = n;
        		out.println(x-1);
        		for(int i = 0 ; i < n-1 ; i++) {
        			out.print(x-- + " ");
        		}
        		out.println();
        	}

        out.close();
    }

    }

//    static void findsubsequences(String s, String ans){
//    	if (s.length() == 0) {
//    		if(ans!="")
//    			if(ans.length()!=l)
//    			al.add(Long.parseLong(ans));
//    		return;
//	}
//
//		// We add adding 1st character in string
//		findsubsequences(s.substring(1), ans + s.charAt(0));
//
//		// Not adding first character of the string
//		// because the concept of subsequence either
//		// character will present or not
//		findsubsequences(s.substring(1), ans);
//}

//    static void sieve(int n)
//    {
//        // Create a boolean array "prime[0..n]" and initialize
//        // all entries it as true. A value in prime[i] will
//        // finally be false if i is Not a prime, else true.
//
//        for(int i=0;i<n;i++)
//            prime[i] = true;
//
//        for(int p = 2; p*p <=n; p++)
//        {
//            // If prime[p] is not changed, then it is a prime
//            if(prime[p] == true)
//            {
//                // Update all multiples of p
//                for(int i = p*p; i <= n; i += p)
//                    prime[i] = false;
//            }
//        }
//    }
 //Print all prime numbers
//        for(int i = 2; i <= n; i++)
//        {
//            if(prime[i] == true)
//                System.out.print(i + " ");
//        }

	class Pair  implements Comparable <Pair>{
		int a ;
		int b ;
		public Pair(int a , int b) {
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			return this.a-o.a;
		}
		public String toString() {
			return "( " + this.a + " , " + this.b + " )\n";
		}

	}

	 class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public int[][] nextInt2DArr(int l, int w) throws IOException {
			int [][] arr = new int[l][w];
			for(int i = 0 ; i < l ; i++)
				for(int j = 0 ; j<w ; j++)
				arr[i][j]= Integer.parseInt(next());
			return arr;
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public int[] nextIntArr(int length) throws IOException {
			int[] arr = new int[length];
			for(int i = 0 ; i < length ; i++)
				arr[i] = Integer.parseInt(next());
			return arr;
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	 }


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

	//static int [] arr;
	//static boolean prime[] = new boolean[1000];
	//static List<Long> al = new ArrayList<>();
	//static int l;
	//static String s; static StringBuilder sb;
	//static HashSet<L> hs;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int t = sc.nextInt();
        //int t = 1;\
        // sieve(600);
        while (t-->0) {
        		int n = sc.nextInt();
        		int x = n;
        		out.println(x);
        		for(int i = 0 ; i < n-1 ; i++) {
        			out.print(x-- + " ");
        		}
        		out.println();
        	}

        out.close();
    }

    }

//    static void findsubsequences(String s, String ans){
//    	if (s.length() == 0) {
//    		if(ans!="")
//    			if(ans.length()!=l)
//    			al.add(Long.parseLong(ans));
//    		return;
//	}
//
//		// We add adding 1st character in string
//		findsubsequences(s.substring(1), ans + s.charAt(0));
//
//		// Not adding first character of the string
//		// because the concept of subsequence either
//		// character will present or not
//		findsubsequences(s.substring(1), ans);
//}

//    static void sieve(int n)
//    {
//        // Create a boolean array "prime[0..n]" and initialize
//        // all entries it as true. A value in prime[i] will
//        // finally be false if i is Not a prime, else true.
//
//        for(int i=0;i<n;i++)
//            prime[i] = true;
//
//        for(int p = 2; p*p <=n; p++)
//        {
//            // If prime[p] is not changed, then it is a prime
//            if(prime[p] == true)
//            {
//                // Update all multiples of p
//                for(int i = p*p; i <= n; i += p)
//                    prime[i] = false;
//            }
//        }
//    }
 //Print all prime numbers
//        for(int i = 2; i <= n; i++)
//        {
//            if(prime[i] == true)
//                System.out.print(i + " ");
//        }

	class Pair  implements Comparable <Pair>{
		int a ;
		int b ;
		public Pair(int a , int b) {
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			return this.a-o.a;
		}
		public String toString() {
			return "( " + this.a + " , " + this.b + " )\n";
		}

	}

	 class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public int[][] nextInt2DArr(int l, int w) throws IOException {
			int [][] arr = new int[l][w];
			for(int i = 0 ; i < l ; i++)
				for(int j = 0 ; j<w ; j++)
				arr[i][j]= Integer.parseInt(next());
			return arr;
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public int[] nextIntArr(int length) throws IOException {
			int[] arr = new int[length];
			for(int i = 0 ; i < length ; i++)
				arr[i] = Integer.parseInt(next());
			return arr;
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	 }


	import java.util.*;
	import java.io.*;
	import java.math.*;
	public class A

	{
		 static FastReader sc=new FastReader();

			  public static void main(String[] args)
	    {
				  StringBuffer sb=new StringBuffer("");
				  int ttt=1;
				     ttt =i();
			        outer :while (ttt-- > 0)
					{

			        	int n=i();
			        	sb.append((n-1)+"\n");
			        	for(int i=2;i<=n;i++)
			        		sb.append(i+" ");
			        	sb.append("\n");

					}
			        System.out.println(sb.toString());
	    }

	static int[] input(int n) {
		int A[]=new int[n];
		   for(int i=0;i<n;i++) {
			   A[i]=sc.nextInt();
		   }
		   return A;
	   }
	static long[] inputL(int n) {
		long A[]=new long[n];
		   for(int i=0;i<n;i++) {
			   A[i]=sc.nextLong();
		   }
		   return A;
	   }
	static String[] inputS(int n) {
		String A[]=new String[n];
		   for(int i=0;i<n;i++) {
			   A[i]=sc.next();
		   }
		   return A;
	   }

	static void input(int A[],int B[]) {
		   for(int i=0;i<A.length;i++) {
			   A[i]=sc.nextInt();
			   B[i]=sc.nextInt();
		   }
	}
	static int max(int A[]) {
		int max=Integer.MIN_VALUE;
		for(int i=0;i<A.length;i++) {
			max=Math.max(max, A[i]);
		}
		return max;
	}
	static int min(int A[]) {
		int min=Integer.MAX_VALUE;
		for(int i=0;i<A.length;i++) {
			min=Math.min(min, A[i]);
		}
		return min;
	}
	static long max(long A[]) {
		long max=Long.MIN_VALUE;
		for(int i=0;i<A.length;i++) {
			max=Math.max(max, A[i]);
		}
		return max;
	}
	static long min(long A[]) {
		long min=Long.MAX_VALUE;
		for(int i=0;i<A.length;i++) {
			min=Math.min(min, A[i]);
		}
		return min;
	}
	static long mod(long x) {
		 int mod=1000000007;
		  return ((x%mod + mod)%mod);
	}

	     static int i() {
	    	 return sc.nextInt();
	     }
	     static String s() {
	    	 return sc.next();
	     }
	     static long l() {
	    	 return sc.nextLong();
	     }
	     static void sort(int[] A){
	        int n = A.length;
	        Random rnd = new Random();
	        for(int i=0; i<n; ++i){
	            int tmp = A[i];
	            int randomPos = i + rnd.nextInt(n-i);
	            A[i] = A[randomPos];
	            A[randomPos] = tmp;
	        }
	        Arrays.sort(A);
	     }
	     static boolean prime(int n)
		    {
		        if (n <= 1)
		            return false;
		        if (n <= 3)
		            return true;
		        if (n % 2 == 0 || n % 3 == 0)
		            return false;
		        double sq=Math.sqrt(n);

		        for (int i = 5; i <= sq; i = i + 6)
		            if (n % i == 0 || n % (i + 2) == 0)
		                return false;
		        return true;
		    }
	     static int gcd(int a, int b)
	     {
	         if (a == 0)
	             return b;
	         return gcd(b % a, a);
	     }

	    static class FastReader
	    {
	        BufferedReader br;
	        StringTokenizer st;

	        public FastReader()
	        {
	            br = new BufferedReader(new
	                     InputStreamReader(System.in));
	        }

	        String next()
	        {
	            while (st == null || !st.hasMoreElements())
	            {
	                try
	                {
	                    st = new StringTokenizer(br.readLine());
	                }
	                catch (IOException  e)
	                {
	                    e.printStackTrace();
	                }
	            }
	            return st.nextToken();
	        }

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

	        long nextLong()
	        {
	            return Long.parseLong(next());
	        }

	        double nextDouble()
	        {
	            return Double.parseDouble(next());
	        }

	        String nextLine()
	        {
	            String str = "";
	            try
	            {
	                str = br.readLine();
	            }
	            catch (IOException e)
	            {
	                e.printStackTrace();
	            }
	            return str;
	        }
	    }
	}


	import java.util.*;
	import java.io.*;
	import java.math.*;
	public class A

	{
		 static FastReader sc=new FastReader();

			  public static void main(String[] args)
	    {
				  StringBuffer sb=new StringBuffer("");
				  int ttt=1;
				     ttt =i();
			        outer :while (ttt-- > 0)
					{

			        	int n=i();
			        	for(int i=2;i<=n;i++)
			        		sb.append(i+" ");
			        	sb.append("\n");

					}
			        System.out.println(sb.toString());
	    }

	static int[] input(int n) {
		int A[]=new int[n];
		   for(int i=0;i<n;i++) {
			   A[i]=sc.nextInt();
		   }
		   return A;
	   }
	static long[] inputL(int n) {
		long A[]=new long[n];
		   for(int i=0;i<n;i++) {
			   A[i]=sc.nextLong();
		   }
		   return A;
	   }
	static String[] inputS(int n) {
		String A[]=new String[n];
		   for(int i=0;i<n;i++) {
			   A[i]=sc.next();
		   }
		   return A;
	   }

	static void input(int A[],int B[]) {
		   for(int i=0;i<A.length;i++) {
			   A[i]=sc.nextInt();
			   B[i]=sc.nextInt();
		   }
	}
	static int max(int A[]) {
		int max=Integer.MIN_VALUE;
		for(int i=0;i<A.length;i++) {
			max=Math.max(max, A[i]);
		}
		return max;
	}
	static int min(int A[]) {
		int min=Integer.MAX_VALUE;
		for(int i=0;i<A.length;i++) {
			min=Math.min(min, A[i]);
		}
		return min;
	}
	static long max(long A[]) {
		long max=Long.MIN_VALUE;
		for(int i=0;i<A.length;i++) {
			max=Math.max(max, A[i]);
		}
		return max;
	}
	static long min(long A[]) {
		long min=Long.MAX_VALUE;
		for(int i=0;i<A.length;i++) {
			min=Math.min(min, A[i]);
		}
		return min;
	}
	static long mod(long x) {
		 int mod=1000000007;
		  return ((x%mod + mod)%mod);
	}

	     static int i() {
	    	 return sc.nextInt();
	     }
	     static String s() {
	    	 return sc.next();
	     }
	     static long l() {
	    	 return sc.nextLong();
	     }
	     static void sort(int[] A){
	        int n = A.length;
	        Random rnd = new Random();
	        for(int i=0; i<n; ++i){
	            int tmp = A[i];
	            int randomPos = i + rnd.nextInt(n-i);
	            A[i] = A[randomPos];
	            A[randomPos] = tmp;
	        }
	        Arrays.sort(A);
	     }
	     static boolean prime(int n)
		    {
		        if (n <= 1)
		            return false;
		        if (n <= 3)
		            return true;
		        if (n % 2 == 0 || n % 3 == 0)
		            return false;
		        double sq=Math.sqrt(n);

		        for (int i = 5; i <= sq; i = i + 6)
		            if (n % i == 0 || n % (i + 2) == 0)
		                return false;
		        return true;
		    }
	     static int gcd(int a, int b)
	     {
	         if (a == 0)
	             return b;
	         return gcd(b % a, a);
	     }

	    static class FastReader
	    {
	        BufferedReader br;
	        StringTokenizer st;

	        public FastReader()
	        {
	            br = new BufferedReader(new
	                     InputStreamReader(System.in));
	        }

	        String next()
	        {
	            while (st == null || !st.hasMoreElements())
	            {
	                try
	                {
	                    st = new StringTokenizer(br.readLine());
	                }
	                catch (IOException  e)
	                {
	                    e.printStackTrace();
	                }
	            }
	            return st.nextToken();
	        }

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

	        long nextLong()
	        {
	            return Long.parseLong(next());
	        }

	        double nextDouble()
	        {
	            return Double.parseDouble(next());
	        }

	        String nextLine()
	        {
	            String str = "";
	            try
	            {
	                str = br.readLine();
	            }
	            catch (IOException e)
	            {
	                e.printStackTrace();
	            }
	            return str;
	        }
	    }
	}


import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int testcases = sc.nextInt();
        while (testcases-- > 0) {
            int n = sc.nextInt();
            System.out.println(n);
            for (int i = 1; i <=n; i++)
                System.out.print(i+" ");
                System.out.println();
        }
        sc.close();
    }
}


import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int testcases = sc.nextInt();
        while (testcases-- > 0) {
            int n = sc.nextInt();
            if(n==1){
                System.out.println("1");
                return;
            }
            int max;
            int min;
            int count = 0;
            int[] arr = new int[n + 1];
            int[] result = new int[n + 3];
            for (int i = 1; i <= n; i++)
                arr[i] = i;
            max = n;
            min = 1;
            int k = 1;
            int max_index = n;
            int diff = n;
            int current_max_index = n;
            while (max != min && count <= n) {
                for (int i = 1; i <= n; i++) {
                    if (current_max_index != i)
                        arr[i] += diff;
                    if (arr[i] > max) {
                        max = arr[i];
                        max_index = i;
                    }
                }
                result[k] = current_max_index;
                k++;
                min = arr[current_max_index];
                current_max_index = max_index;
                diff = max - min;
                max = 0;
                count++;
            }
            System.out.println(count - 1);
            for (int i = 1; i < k - 1; i++)
                System.out.print(result[i] + " ");
            System.out.println();
        }
    }
}


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

/* Name of the class has to be "Main" only if the class is public. */
public class q2
{
	public static void main (String[] args) throws java.lang.Exception
	{
        // your code goes here
        Scanner sc= new Scanner(System.in);
        int t = Integer.parseInt(sc.next());
        while(t-->0)
        {
          int n = Integer.parseInt(sc.next());
          System.out.println(n);
          for(int i=1;i<=n;i++)
          {
              System.out.print(i+" ");
          }
          System.out.println("");

        }
    }
}