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.
import java.io.*;
import java.util.*;

public class C {

  private static final String REGEX = " ";
  private static final Boolean DEBUG = false;
  private static final String FILE_NAME = "input.txt";


  public static void main(String[] args) throws IOException {
    if (DEBUG) {
      generate();
    }
    Solver solver = new Solver();
    solver.readData();
    solver.solve();
    solver.print();
  }

  private static void generate() throws IOException {

  }

  private static class Solver {
    private StringBuilder myStringBuilder = new StringBuilder();
    int n;
    int[] a;

    void readData() throws IOException {
      Scanner scanner = new Scanner();
      n = scanner.nextInt();
      a = splitInteger(scanner.nextLine(), n);
      scanner.close();
    }

    void solve() {
      Set<List<Integer>> results = new HashSet<>();
      boolean[] used = new boolean[n + 1];
      Integer[] indexes = new Integer[n];
      for (int i = 0; i < n; i++) {
        indexes[i] = i + 1;
      }
      Arrays.sort(indexes, Comparator.comparingInt(o -> a[o-1]));
      for (int i = 0; i < n; i++) {
        if (used[indexes[i]]) {
          continue;
        }
        used[indexes[i]] = true;
        ArrayList<Integer> ind = new ArrayList<>();
        ind.add(indexes[i]);
        int j = indexes[i];
        while (j != i + 1) {
          j = indexes[j - 1];
          used[j] = true;
          ind.add(j);
        }
        results.add(ind);
      }
      out(results.size());
      out('\n');
      for (List<Integer> result : results) {
        int size = result.size();
        out(size);
        out(' ');
        for (int i = 0; i < size; i++) {

          out(result.get(i));
          if (i != size - 1) {
            out(' ');
          } else {
            out('\n');
          }
        }

      }
    }

    void print() {
      System.out.println(myStringBuilder);
    }


    void out(Object object) {
      myStringBuilder.append(object);
    }

    void out(String string) {
      myStringBuilder.append(string);
    }

    public void out(boolean b) {
      myStringBuilder.append(b);
    }

    public void out(char c) {
      myStringBuilder.append(c);
    }

    public void out(int i) {
      myStringBuilder.append(i);
    }

    public void out(long lng) {
      myStringBuilder.append(lng);
    }

    public void out(float f) {
      myStringBuilder.append(f);
    }

    public void out(double d) {
      myStringBuilder.append(d);
    }

    public void newLine() {
      myStringBuilder.append("\n");
    }

    @SuppressWarnings("SameParameterValue")
    int[] splitInteger(String string, int n) {
      final String[] split = string.split(REGEX, n);
      int[] result = new int[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Integer.parseInt(split[i]);
      }
      return result;
    }

    public int[] splitInteger(String string) {
      return splitInteger(string, 0);
    }


    @SuppressWarnings("SameParameterValue")
    long[] splitLong(String string, int n) {
      final String[] split = string.split(REGEX, n);
      long[] result = new long[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Long.parseLong(split[i]);
      }
      return result;
    }

    public long[] splitLong(String string) {
      return splitLong(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    double[] splitDouble(String string, int n) {
      final String[] split = string.split(REGEX, n);
      double[] result = new double[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Double.parseDouble(split[i]);
      }
      return result;
    }

    public double[] splitDouble(String string) {
      return splitDouble(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    String[] splitString(String string, int n) {
      return string.split(REGEX, n);
    }

    public String[] splitString(String string) {
      return splitString(string, 0);
    }

    public int max(int a, int b) {
      return Math.max(a, b);
    }

    public int max(int[] arr) {
      int max = Integer.MIN_VALUE;
      for (int x : arr) {
        max = max(max, x);
      }
      return max;
    }

    public long max(long a, long b) {
      return Math.max(a, b);
    }

    public int min(int a, int b) {
      return Math.min(a, b);
    }

    public long min(long a, long b) {
      return Math.min(a, b);
    }

    public double max(double a, double b) {
      return Math.max(a, b);
    }

    public double min(double a, double b) {
      return Math.min(a, b);
    }

    private final static int MOD = 1000000009;

    int multMod(int a, int b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    int sumMod(int a, int b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }

    long multMod(long a, long b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    long sumMod(long a, long b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }

    int sum(int[] arr) {
      int sum = 0;
      for (int i = 0; i < arr.length; i++) {
        sum += arr[i];
      }
      return sum;
    }

    long sum(long[] arr) {
      long sum = 0;
      for (int i = 0; i < arr.length; i++) {
        sum += arr[i];
      }
      return sum;
    }

  }

  private static class Scanner {
    private int currentIndex = 0;
    private String[] objects;
    private final BufferedReader myReader;
    private Computable<Character> charComputer;
    private Computable<Double> doubleComputer;
    private Computable<Integer> intComputer;
    private Computable<Long> longComputer;

    Scanner() throws FileNotFoundException {
      InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;
      myReader = new BufferedReader(new InputStreamReader(in));
      charComputer = () -> objects[currentIndex].charAt(0);
      doubleComputer = () -> Double.parseDouble(objects[currentIndex]);
      intComputer = () -> Integer.parseInt(objects[currentIndex]);
      longComputer = () -> Long.parseLong(objects[currentIndex]);
    }

    String nextLine() throws IOException {
      objects = null;
      currentIndex = 0;
      return myReader.readLine();
    }

    int nextInt() throws IOException {
      return next(intComputer);

    }

    long nextLong() throws IOException {
      return next(longComputer);

    }

    double nextDouble() throws IOException {
      return next(doubleComputer);

    }

    char nextChar() throws IOException {
      return next(charComputer);
    }

    <T> T next(Computable<T> computer) throws IOException {
      T result;
      if (objects == null || currentIndex >= objects.length) {
        String s = myReader.readLine();
        objects = s.split(" ");
        currentIndex = 0;
      }
      result = computer.compute();
      currentIndex++;
      return result;
    }

    interface Computable<T> {
      T compute();
    }

    public void close() throws IOException {
      myReader.close();
    }
  }

}
