You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation. 

  * Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the following |D_2| cards and so on). Then reverse the order of the parts, transforming the deck into D_k, D_{k-1}, ..., D_2, D_1 (so, the first |D_k| cards of the new deck are D_k, the following |D_{k-1}| cards are D_{k-1} and so on). The internal order of each packet of cards D_i is unchanged by the operation. 



You have to obtain a sorted deck (i.e., a deck where the first card is 1, the second is 2 and so on) performing at most n operations. It can be proven that it is always possible to sort the deck performing at most n operations.

Examples of operation: The following are three examples of valid operations (on three decks with different sizes). 

  * If the deck is [3 6 2 1 4 5 7] (so 3 is the first card and 7 is the last card), we may apply the operation with k=4 and D_1=[3 6], D_2=[2 1 4], D_3=[5], D_4=[7]. Doing so, the deck becomes [7 5 2 1 4 3 6]. 
  * If the deck is [3 1 2], we may apply the operation with k=3 and D_1=[3], D_2=[1], D_3=[2]. Doing so, the deck becomes [2 1 3]. 
  * If the deck is [5 1 2 4 3 6], we may apply the operation with k=2 and D_1=[5 1], D_2=[2 4 3 6]. Doing so, the deck becomes [2 4 3 6 5 1]. 

Input

The first line of the input contains one integer n (1≤ n≤ 52) — the number of cards in the deck.

The second line contains n integers c_1, c_2, ..., c_n — the cards in the deck. The first card is c_1, the second is c_2 and so on.

It is guaranteed that for all i=1,...,n there is exactly one j∈\{1,...,n\} such that c_j = i.

Output

On the first line, print the number q of operations you perform (it must hold 0≤ q≤ n).

Then, print q lines, each describing one operation.

To describe an operation, print on a single line the number k of parts you are going to split the deck in, followed by the size of the k parts: |D_1|, |D_2|, ... , |D_k|. 

It must hold 2≤ k≤ n, and |D_i|≥ 1 for all i=1,...,k, and |D_1|+|D_2|+⋅⋅⋅ + |D_k| = n.

It can be proven that it is always possible to sort the deck performing at most n operations. If there are several ways to sort the deck you can output any of them.

Examples

Input


4
3 1 2 4


Output


2
3 1 2 1
2 1 3


Input


6
6 5 4 3 2 1


Output


1
6 1 1 1 1 1 1


Input


1
1


Output


0

Note

Explanation of the first testcase: Initially the deck is [3 1 2 4]. 

  * The first operation splits the deck as [(3) (1 2) (4)] and then transforms it into [4 1 2 3]. 
  * The second operation splits the deck as [(4) (1 2 3)] and then transforms it into [1 2 3 4]. 

Explanation of the second testcase: Initially the deck is [6 5 4 3 2 1]. 

  * The first (and only) operation splits the deck as [(6) (5) (4) (3) (2) (1)] and then transforms it into [1 2 3 4 5 6]. 
/**
 * @author vivek
 * programming is thinking, not typing
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class C {

    static int n;
    static int[] arr;

    private static void solveTC(int __) {

        /* For Google */
//		ans.append("Case #").append(__).append(": ");

        //code start

        n = scn.nextInt();
        int lo = 1, hi = n;
        arr = scn.nextIntArray(n);

        if (n == 1) {
            print("0\n");
            return;
        }

        int aa = find(arr, 1);
        int bb = find(arr, n);

        int c = 0;

        boolean asc = bb > aa;

        while (lo < hi) {


            String str = "";

            int fi = find(arr, lo);
            int li = find(arr, hi);

            int mid = hi - lo - 1;

            if (asc && fi < li) {

                if (mid == li - fi - 1) {
                    lo++;
                    hi--;
                    continue;
                }

                printIt(lo, fi, li, hi);
                c++;
                asc = false;

            } else if (!asc && fi > li) {

                if (mid == fi - li - 1) {
                    lo++;
                    hi--;
                    continue;
                }

                printIt(lo, li, fi, hi);
                c++;
                asc = true;

            } else {
                printIt(lo, hi);
                c++;
                asc = !asc;
                continue;
            }

            lo++;
            hi--;
        }

        if (!asc) {
            print(n + " ");
            c++;
            for (int i = 0; i < n; i++) {
                print("1 ");
            }
        }

        System.out.println(c);

        //code end

        print("\n");
    }

    private static void printIt(int lo, int hi) {

        StringBuilder str = new StringBuilder();
        int c = 0;

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

        for (int i = 1; i < lo; i++) {
            str.append("1 ");
            c++;
            lists.add(new ArrayList<>(Collections.singletonList(arr[i - 1])));
        }

        ArrayList<Integer> lis = new ArrayList<>();
        str.append(hi - lo + 1).append(" ");
        c++;
        for (int i = lo; i <= hi; i++) {
            lis.add(arr[i - 1]);
        }
        lists.add(lis);

        for (int i = 1; i < lo; i++) {
            str.append("1 ");
            c++;
            lists.add(new ArrayList<>(Collections.singletonList(arr[i - 1])));
        }

        ArrayList<Integer> fin = new ArrayList<>();
        for (int i = lists.size() - 1; i >= 0; i--) {
            fin.addAll(lists.get(i));
        }

        for (int i = 0; i < n; i++) {
            arr[i] = fin.get(i);
        }

        print(c + " " + str + "\n");

    }

    private static void printIt(int lo, int fi, int li, int hi) {

        StringBuilder str = new StringBuilder();
        int c = 0;

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

        for (int i = 1; i < lo; i++) {
            str.append("1 ");
            c++;
            lists.add(new ArrayList<>(Collections.singletonList(arr[i - 1])));
        }

        str.append(fi - lo + 1).append(" ");
        c++;
        ArrayList<Integer> lis = new ArrayList<>();
        for (int i = lo; i <= fi; i++) {
            lis.add(arr[i - 1]);
        }
        lists.add(lis);

        if (li - fi > 1) {
            lis = new ArrayList<>();
            str.append(li - fi - 1).append(" ");
            c++;
            for (int i = fi + 1; i <= li - 1; i++) {
                lis.add(arr[i - 1]);
            }
            lists.add(lis);
        }

        str.append(hi - li + 1).append(" ");
        c++;
        lis = new ArrayList<>();
        for (int i = li; i <= hi; i++) {
            lis.add(arr[i - 1]);
        }
        lists.add(lis);


        for (int i = 1; i < lo; i++) {
            str.append("1 ");
            c++;
            lists.add(new ArrayList<>(Collections.singletonList(arr[i - 1])));
        }

        ArrayList<Integer> fin = new ArrayList<>();
        for (int i = lists.size() - 1; i >= 0; i--) {
            fin.addAll(lists.get(i));
        }

        for (int i = 0; i < n; i++) {
            arr[i] = fin.get(i);
        }

        print(c + " " + str + "\n");

    }

    private static int find(int[] arr, int ele) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == ele) {
                return i + 1;
            }
        }
        return -1;
    }

    /**
     * Don't copy other's templates, make your own <br>
     * It would be much more beneficial
     */

    public static void main(String[] args) {
        scn = new Scanner();
        ans = new StringBuilder();
//        int t = scn.nextInt();
        int t = 1;

//        int limit=               ;
//        sieve(limit);

        /*
        try {
            System.setOut(new PrintStream(new File("file_i_o\\output.txt")));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
*/
        for (int i = 1; i <= t; i++) {
            solveTC(i);
        }
        System.out.print(ans);
    }
    //Stuff for prime start

    /**
     * List containing prime numbers <br>
     * <b>i<sup>th</sup></b> position contains <b>i<sup>th</sup></b> prime number <br>
     * 0th index is <b>null</b>
     */
    private static ArrayList<Integer> listOfPrimes;

    /**
     * query <b>i<sup>th</sup></b> element to get if its prime of not
     */
    private static boolean[] isPrime;

    /**
     * Performs Sieve of Erathosnesis and initialise isPrime array and listOfPrimes list
     *
     * @param limit the number till which sieve is to be performed
     */
    private static void sieve(int limit) {
        listOfPrimes = new ArrayList<>();
        listOfPrimes.add(null);
        boolean[] array = new boolean[limit + 1];

        Arrays.fill(array, true);
        array[0] = false;
        array[1] = false;

        for (int i = 2; i <= limit; i++) {
            if (array[i]) {
                for (int j = i * i; j <= limit; j += i) {
                    array[j] = false;
                }
            }
        }
        isPrime = array;
        for (int i = 0; i <= limit; i++) {
            if (array[i]) {
                listOfPrimes.add(i);
            }
        }
    }
    //stuff for prime end

    /**
     * Calculates the Least Common Multiple of two numbers
     *
     * @param a First number
     * @param b Second Number
     * @return Least Common Multiple of <b>a</b> and <b>b</b>
     */
    private static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    /**
     * Calculates the Greatest Common Divisor of two numbers
     *
     * @param a First number
     * @param b Second Number
     * @return Greatest Common Divisor of <b>a</b> and <b>b</b>
     */
    private static long gcd(long a, long b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    static void print(Object obj) {
        ans.append(obj.toString());
    }


    static Scanner scn;
    static StringBuilder ans;

    //Fast Scanner
    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
/*
            try {
                br = new BufferedReader(new
                        InputStreamReader(new FileInputStream(new File("file_i_o\\input.txt"))));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
*/
        }

        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;
        }

        int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        Integer[] nextIntegerArray(int n) {
            Integer[] array = new Integer[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        long[] nextLongArray(int n) {
            long[] array = new long[n];
            for (int i = 0; i < n; i++) {
                array[i] = nextLong();
            }
            return array;
        }

        String[] nextStringArray() {
            return nextLine().split(" ");
        }

        String[] nextStringArray(int n) {
            String[] array = new String[n];
            for (int i = 0; i < n; i++) {
                array[i] = next();
            }
            return array;
        }
    }
}
