Problem: You are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order, the total sequence also will be sorted in increasing order.

Sorting integers in a subsequence is a process such that the numbers included in a subsequence are ordered in increasing order, and the numbers which are not included in a subsequence don't change their places.

Every element of the sequence must appear in exactly one subsequence.

Input

The first line of input data contains integer n (1 ≤ n ≤ 105) — the length of the sequence.

The second line of input data contains n different integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109) — the elements of the sequence. It is guaranteed that all elements of the sequence are distinct.

Output

In the first line print the maximum number of subsequences k, which the original sequence can be split into while fulfilling the requirements.

In the next k lines print the description of subsequences in the following format: the number of elements in subsequence ci (0 < ci ≤ n), then ci integers l1, l2, ..., lci (1 ≤ lj ≤ n) — indices of these elements in the original sequence. 

Indices could be printed in any order. Every index from 1 to n must appear in output exactly once.

If there are several possible answers, print any of them.

Examples

Input

6
3 2 1 6 5 4


Output

4
2 1 3
1 2
2 4 6
1 5


Input

6
83 -75 -49 11 37 62


Output

1
6 1 2 3 4 5 6

Note

In the first sample output:

After sorting the first subsequence we will get sequence 1 2 3 6 5 4.

Sorting the second subsequence changes nothing.

After sorting the third subsequence we will get sequence 1 2 3 4 5 6.

Sorting the last subsequence changes nothing.

Solution (in JAVA):

Solution:

import java.io.*;
import java.nio.ByteBuffer;
import java.util.*;

/**
 * Created by imahmoud on 5/13/17.
 */
public class C {
    static class Writer {
        private OutputStream out;
        public Writer(){
             out = new BufferedOutputStream(System.out);
        }

        public void println() throws IOException {
            out.write('\n');
        }
        public void println(String str) throws IOException {
            this.print(str);
            out.write('\n');
        }
        public void println(char v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(short v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(int v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(long v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(double v) throws IOException {
            this.print(v);
            out.write('\n');
        }
        public void println(float v) throws IOException {
            this.print(v);
            out.write('\n');
        }

        public void print(String str) throws IOException {
            out.write(str.getBytes());
        }
        public void print(char v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(short v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(int v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(long v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(double v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }
        public void print(float v) throws IOException {
            out.write(String.valueOf(v).getBytes());
        }

        public void flush() throws IOException {
            out.flush();
            out.close();
        }
    }
    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 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  int findIndex(Long[] a, long key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    }

    public void solve() throws IOException {
        Reader in =  new Reader();
        Writer out = new Writer();
        //PrintStream out = new PrintStream(System.out);
        int N  = in.nextInt();

        Long[] arr = new Long[N];
        for (int i = 0; i < N; i++) {
            arr[i] = in.nextLong();
        }
        Long[] arr_s = arr.clone();
        Arrays.sort(arr_s);


        boolean[] visited = new boolean[N];
        List<List<Integer>> res = new ArrayList<>();
        for (int i = 0; i < N; i++) {

            if(visited[i])
                continue;
            long l = arr[i];
            int t_index = findIndex(arr_s, l);
            int c_index = i;


            List<Integer> list = new ArrayList<>();
            visited[c_index] = true;
            list.add(c_index);
            while (t_index != c_index) {
                long tmp        = arr[c_index];
                arr[c_index]    = arr[t_index];
                arr[t_index]    = tmp;
                visited[t_index]   = true;
                list.add(t_index);
                t_index = findIndex(arr_s, arr[c_index]);
            }
            res.add(list);
        }

       out.println(res.size());

        for (int i = 0; i < res.size(); i++) {
            List<Integer> list = res.get(i);
            out.print(list.size());
            for (int j = 0; j < list.size(); j++) {
                out.print(' ');
                out.print(list.get(j) + 1);
            }
            out.println();
        }
        out.flush();

    }
    public static void main(String[] args)  throws Exception{
        try {
            new C().solve();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}