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.math.*;
import java.nio.file.attribute.AclEntry.Builder;
import java.security.KeyStore.Entry;
import java.util.*;
	public  class Main {
		private InputStream is;
		private PrintWriter out;
		int time = 0, val[][], dp[][], DP[], start[], end[], dist[],  black[];
		static int MOD = (int)(1e9+7);
		int arr[];
		int weight[][];
		int x[];
		int y[];
		int parent[];
		int MAX = 800000, N, K, L;
		long red[];
		ArrayList<Integer>[] amp;
		//boolean b[], boo[][];
		Pair prr[];
		HashSet<Integer> hs = new HashSet<>();
		long Dp[][][][] = new long[110][110][12][12];
	 
		public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
			public void run() {
				try {
	 
			//new CODEFORCES().soln();
			} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
			new Main().soln();
		}
		char ch[][];
		//int ans = 0, cnt = 0, Q;
		int n1, n2, k1, k2, M;
		static ArrayList<Integer>[] g;
		static long ok[];	
		static int phi[]=new int[500005];//static int b[]=new int[100005];
		void solve(){
                int n=ni();
                int a[]=na(n);
                int b[]=Arrays.copyOf(a,n);
                Arrays.sort(b);
                g=new ArrayList[n+1];
                HashMap<Integer,Integer> hm=new HashMap();
                for(int i=0;i<n;i++)
                {
                	hm.put(a[i],i+1);
                }
                for(int i=1;i<=n;i++)
                	g[i]=new ArrayList<Integer>();
                for(int i=0;i<n;i++)
                {
                	int x=hm.get(b[i]);
                	g[i+1].add(x);
                	g[x].add(i+1);
                }
                ans=new ArrayList[n+1];
                for(int i=0;i<=n;i++)
                	ans[i]=new ArrayList<Integer>();
                for(int i=1;i<=n;i++)
                {
                	if(!visited[i])
                	{
                		dfs(i);
                		count++;
                	}
                }
                out.println(count);
                for(int i=0;i<count;i++)
                {
                	out.print(ans[i].size()+" ");
                	for(int x:ans[i])
                	{
                		out.print(x+" ");
                	}
                	out.println();
                }
}
		static ArrayList<Integer> ans[];
		static int count=0;
		private void dfs(int curr) {
			visited[curr]=true;
			ans[count].add(curr);
			for(int x:g[curr])
			{
				if(!visited[x])
				{
					dfs(x);
				}
			}
		}
		static boolean visited[]=new boolean[100005];

            boolean isPrime(int x){
			for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;
			return true;
		}
	    int  p ;
		void buildGraph(int n)
		{
			for(int i = 0; i<n ;i++){
				int x1 = ni() -1, y1 = ni()-1;
				amp[x1].add(y1);
				amp[y1].add(x1);
				x[i] = x1; y[i] = y1;
			}
		}
		long get(int x){
			long val = 0;
			for(int i = 0; i< N; i++){
				val += Math.abs(x-arr[i]);
				x+=L;
			}
			return val;
		}
		
		long modInverse(long a, long mOD2){
	        return  power(a, mOD2-2, mOD2);
		}
		long power(long x, long y, long m)
		{
			if (y == 0)
	    return 1;
		long p = power(x, y/2, m) % m;
		p = (p * p) % m;
	 
		return (y%2 == 0)? p : (x * p) % m;
		}
		
		public long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}
		
		public static int[] shuffle(int[] a, Random gen){
			for(int i = 0, n = a.length;i < n;i++)
			{ 
				int ind = gen.nextInt(n-i)+i; 
				int d = a[i]; 
				a[i] = a[ind];
				a[ind] = d; 
			} 
		return a; 
		}
	 
		class Pair implements Comparable<Pair>{
			int ind,off_sal, max_job;
			Pair(int ind,int off_sal, int max_job){
				this.ind=ind;
				this.off_sal = off_sal;
				this.max_job = max_job;
			}
			
			public int hashCode() {
				return Objects.hash();
			}
			
			public int compareTo(Pair other) {
			return (int)(other.off_sal-this.off_sal);
			}
			
		}
		class Pair1 implements Comparable<Pair1>{
			long index;
			long val;
			Pair1(long s,long time){
			this.index=s;
			this.val=time;
			//this.min=Integer.MAX_VALUE;
			}
			public int hashCode() {
				return Objects.hash();
			}
			
			@Override
			public int compareTo(Pair1 arg0) {
				return (int)(val-arg0.val);
			}
			
		}
		long power(long x, long y, int mod){
			long ans = 1;
			while(y>0){
				if(y%2==0){
					x = (x*x)%mod;
					y/=2;
				}
				else{
					ans = (x*ans)%mod;
					y--;
				}
			}
			return ans;
		}
		void soln() {
			is = System.in;
			out = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			//out.close();
			out.flush();
			//tr(System.currentTimeMillis() - s + "ms");
		}
	 
	 
		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;
	 
		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}
	 
		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}
	 
		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}
	 
		private double nd() {
			return Double.parseDouble(ns());
		}
	 
		private char nc() {
			return (char) skip();
		}
		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
	 
		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}
	 
		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}
	 
		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}
	 
		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}
	 
			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}
	 
		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}
	 
			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}
	 
		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	 
		private void tr(Object... o) {
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}