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.util.*;
import java.io.*;
 
 
   
 
 
 
  public   class Sample implements Runnable{
   // static ArrayList<Integer>[] al;
         static class Pair implements Comparable<Pair>{
  long a;
  int b;
   
  Pair(){
 
  }
  Pair(long a,int b){
      this.a=a;
      this.b=b;
  }
   
  public int compareTo(Pair x)
        {

   
        return Long.compare(this.a,x.a);
    }
}
  static class Beauty implements Comparator<Beauty>{
    int beauty;
    int cost;
    Beauty(){
        }
    Beauty(int beauty,int cost){
      this.beauty=beauty;
      this.cost=cost;
 
    }
    public int compare(Beauty b1,Beauty b2 ){
      if(b2.beauty-b1.beauty==0){
        return b1.cost-b2.cost;
      }else{
        return b2.beauty-b1.beauty;
      }
    }
 
  }
   
  

   static InputReader sc = new InputReader(); 
   static int gcd(int a,int b){
    if(a==0){
      return b;
    }
    return gcd(b%a,a);
   }
   static int d;
   static int[] color;
   static boolean[] v;
  /*  static void dfs(int src,int x,int y){
      v[src]=true;
     int  i=1;
     color[src]=x;
      for(int a :al[src]){
        if(v[a]) continue;
        if(i==x|| i==y){
          i++;
          if(i==x|| i==y){
          i++;
        }
        }
        color[a]=i;
        i++;
         
      }
      for(int a:al[src]){
        if(!v[a]){
          dfs(a,color[a],x);
        }
      }
 
 
 
    }*/
    static long[] a;
    static long[] b;
    public static boolean possible(double mid,int n){
      double l=a[1]-b[1]*mid;
      double r=a[1]+b[1]*mid;
      for(int i=2;i<=n;i++){
        l=Math.max(l,a[i]-b[i]*mid);
        r=Math.min(r,a[i]+b[i]*mid);
 
      }
      if(l>r)return false;
      else  return true;
    }
 
public static boolean isvowel(char ch){
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
        return true;
    }else{
        return false;
    }
}
static long[] fac;
 static long[] inv;
 static long mod=(long)1e9+7;
static int[] prime;
static Integer[] ans;
 
static ArrayList<Integer>[] al1;
static ArrayList<Integer>[] al2;
static int[] lol1;
static int[] lol2;
static boolean[] v1;
static boolean[] v2;
 
 
    
     public static void main(String[] args) throws IOException
    { 
         new Thread(null, new Sample(), "whatever", 1<<26).start();
         

      
    }
   

   

     boolean findSum(int set[], int n, long sum)
    {
       // Base Cases
       if (sum == 0)
         return true;
       if (n == 0 && sum != 0)
         return false;
      
       // If last element is greater than sum, then ignore it
       if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      
       /* else, check if sum can be obtained by any of the following
          (a) including the last element
          (b) excluding the last element   */
       return findSum(set, n-1, sum) || 
                                   findSum(set, n-1, sum-set[n-1]);
    }
 
 
  public class IntegerComparator implements Comparator<Integer> {

    @Override
    public int compare(Integer o1, Integer o2) {
        return o2.compareTo(o1);
    }
}
    static int[] pro_a;
    static ArrayList pro_b[];
    static ArrayList<Integer> seg[];
    public static void build(int low,int high,int pos){
      if(low>high){ return ;}
      if(low==high){
        seg[pos]=pro_b[low];
        return;
        
      }
      int mid=(low+high)>>1;
      build(low,mid,2*pos+1);
      build(mid+1,high,2*pos+2);
      seg[pos]=merge(seg[2*pos+1],seg[2*pos+2]);
      
    }
    public static ArrayList merge(ArrayList<Integer> a1,ArrayList<Integer> a2){
      ArrayList<Integer> result=new ArrayList<Integer>();
      int i=0;
      int j=0;
      while(i<a1.size() && j<a2.size()){
        if((a1.get(i))<(a2.get(j))){
         
          result.add(a1.get(i));
           i++;
        }
        else if(a1.get(i)>a2.get(j)){
          
          result.add(a2.get(j));
          j++;
        }
        else{
         
          result.add(a1.get(i));
          result.add(a2.get(j));
           i++;j++;
        }

      }
      while(i<a1.size()){
        result.add(a1.get(i));
        i++;
      }
      while(j<a2.size()){
        result.add(a2.get(j));
          j++;
      }
       
      
      return result;
    }
    public int find(int low,int high,int pos,int l,int r,int x,int y){
          if(l<=low && high<=r){
            int find_x=lower_bound(seg[pos],x);
            int find_y=upper_bound(seg[pos],y);
          // System.out.println(find_x+" "+find_y);
            return (find_y-find_x);
          }
          if(l>high || r<low){
            return 0;
          }
          int mid=(low+high)>>1;
          return find(low,mid,2*pos+1,l,r,x,y)+find(mid+1,high,2*pos+2,l,r,x,y);
    }
    int lower_bound(ArrayList<Integer> a, int key) {
        int l = 0;
        int h = a.size(); // Not n - 1
 
        
        
        while (l < h) {
            int mid = (l + h) / 2;
            if (key <= a.get(mid)) {
                h = mid;
            } else {
                l = mid + 1;
            }
        }
        return l;
    }
      int upper_bound(ArrayList<Integer> a, int key) {
        int l = 0;
          int h = a.size(); // Not n - 1
 
          if(key>=a.get(h-1))
          return (h);
        
        while (l < h) {
            int mid = (l + h) / 2;
            if (key >= a.get(mid)) {
                l = mid + 1;
            } else {
                h = mid;
            }
        }
  
        return l;
    }
    static ArrayList[] dfs_array;
    static boolean[] visited;
    static int count=0;
    static double ans22=0;
    public void run(){
                      int n=i();
                      Pair[] p=new Pair[n];
                      for (int i=0;i<n ;i++ ) {
                          long a=l();
                          p[i]=new Pair(a,i);
                      }
                      Arrays.sort(p);
                      boolean[] lol=new boolean[n];
                      int[] child=new int[n];
                      for (int i=0;i<n ;i++ ) {
                         Pair p1=p[i];
                         child[i]=p1.b;
                         
                      }
                      int count=0;
                      ArrayList<ArrayList> hs=new ArrayList();
                      for (int i=0;i<n ;i++ ) {
                        if(!lol[i]){
                          
                          count++;
                          ArrayList al=new ArrayList();
                          lol[i]=true;
                          int start=i;
                          int j=i;
                           al.add(i+1);
                          while(child[j]!=start){
                              lol[j]=true;
                             
                              j=child[j];
                               al.add(j+1);

                          }lol[j]=true;

                         hs.add(al);
                        }
                      }
                      System.out.println(count);
                      Iterator it=hs.iterator();
                      while(it.hasNext()){
                        ArrayList al=(ArrayList)it.next();
                        Iterator tt=al.iterator();
                        System.out.print(al.size()+" ");
                        while(tt.hasNext()){
                          System.out.print(tt.next()+" ");

                        }
                        System.out.println();
                      }
                      
       }
       
       
       
     public static int lower_bound_array(int[] arr, long key) {
    int len = arr.length;
    int lo = 0;
    int hi = len-1;
    int mid = (lo + hi)/2;
    while (true) {
      int cmp = Long.compare(arr[mid],(key));
       
        if (cmp < 0) {
        lo = mid+1;
        if (hi < lo)
          return mid<len-1?mid+1:-1;
      } else {
        hi = mid-1;
        if (hi < lo)
          return mid;
      }
      mid = (lo + hi)/2;
    }
  }
         
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    
    /////////////////////////////////////////////////////////// shortcuts //////////////////////////////
      public static long modPow(long base, long exp, long mod) {
        base = base % mod;
        long result = 1;
        while (exp > 0) {
            if (exp % 2 == 1) {
                result = (result * base) % mod;
                exp--;
            } else {
                base = (base * base) % mod;
                exp = exp >> 1;
            }
 
        }
        return result;
    }
 
 
    public static void cal() {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++) {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }
 
   /* public static long ncr(int n, int r) {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }
 */
 
      static int i() {
           
          return sc.nextInt();
        }
        static long l(){
          return sc.nextLong();
 
        }
        static double d() {
          return sc.nextDouble();
        }
        static String s(){
          return sc.next();
 
        }
        static String sL() throws IOException{
          return sc.nextLine();
        }
       static void loop(int[] a) throws IOException{
          for(int j=0;j<a.length;j++){
              a[j]=i();
          }
        }
        static void eloop(int[] a) throws IOException{
          for(int i=1;i<=a.length;i++){
              a[i]=i();
          }
        }
        static void ploop(int[] a)throws IOException{
             for(int j=0;j<a.length;j++){
                System.out.println(a[j]);
             }
 
        }
        static void eploop(int[] a)throws IOException{
             for(int j=1;j<=a.length;j++){
                System.out.println(a[j]);
             }
 
        } 
  
        ////////////////////////////////////////////////////////////////////////////////////////////////////
     
 
   
 
  static class InputReader {
        BufferedReader br;
        StringTokenizer st;
 
        public InputReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e) {
                    throw new RuntimeException();
                }
            }
            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) {
                throw new RuntimeException();
            }
            return str;
        }
    }
 
 }