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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int maxarr(vector<int> &arr);
int minarr(vector<int> &arr);
long long modulo(long long base, long long exponent, long long modulus);
long long choose(long long n, long long k);
bool isprime(long long n);
long long inverse(long long a, long long m);
long long fastmult(long long a, long long b, long long c);
vector<long long> a(1000010);
vector<long long> prime;
long long sum[1000010];
vector<bool> aprime(1000010);
void setprime();
long long divCeil(long long a, long long b);
long long arrceil(vector<long long> a, long long k);
int main() {
  long long n;
  cin >> n;
  vector<long long> b(n);
  for (int i = 0; i < n; i++) scanf("%lld", &b[i]);
  ;
  vector<long long> c = b;
  sort(c.begin(), c.end());
  vector<long long> a(n);
  map<long long, long long> mymap;
  for (int i = 0; i < n; i++) {
    mymap[c[i]] = i + 1;
  }
  for (int i = 0; i < n; i++) {
    a[i] = mymap[b[i]];
  }
  long long ans = 0;
  vector<long long> aa[n];
  set<long long> main;
  long long j;
  for (int i = 0; i < n; i++) {
    if (!main.count(i)) {
      set<long long> temp;
      temp.insert(i);
      main.insert(i);
      aa[ans].push_back(i);
      j = a[i] - 1;
      while (i != j) {
        temp.insert(j);
        main.insert(j);
        aa[ans].push_back(j);
        j = a[j] - 1;
      }
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << aa[i].size() << " ";
    for (int j = 0; j < aa[i].size(); j++) cout << aa[i][j] + 1 << " ";
    cout << endl;
  }
  return 0;
}
int maxarr(vector<int> &arr) {
  int maxi = INT_MIN;
  for (int i = 0; i < arr.size(); i++) maxi = max(arr[i], maxi);
  return maxi;
}
int minarr(vector<int> &arr) {
  int mini = INT_MAX;
  for (int i = 0; i < arr.size(); i++) mini = min(arr[i], mini);
  return mini;
}
long long modulo(long long base, long long exponent, long long modulus) {
  if (modulus == 1) return 0;
  long long result = 1;
  base = base % modulus;
  while (exponent > 0) {
    if (exponent % 2 == 1) {
      result = (result * base) % modulus;
    }
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
long long choose(long long n, long long k) {
  if (k == 0) return 1;
  return (n * choose(n - 1, k - 1)) / k;
}
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
void EE(long long a, long long b, long long &co1, long long &co2) {
  if (a % b == 0) {
    co1 = 0;
    co2 = 1;
    return;
  }
  EE(b, a % b, co1, co2);
  long long temp = co1;
  co1 = co2;
  co2 = temp - co2 * (a / b);
}
long long inverse(long long a, long long m) {
  long long x, y;
  EE(a, m, x, y);
  if (x < 0) x += m;
  return x;
}
long long fastmult(long long a, long long b, long long c) {
  if (b == 0) return 0;
  long long res = fastmult(a, b >> 1, c);
  res = (res + res) % c;
  if (b % 2 == 1) {
    res = (res + a) % c;
  }
  return res;
}
void setprime() {
  aprime[0] = true;
  for (int i = 2; i * i <= 1000010; i++) {
    if (aprime[i - 1] == false) {
      for (int j = i * 2; j <= 1000010; j += i) {
        aprime[j - 1] = true;
      }
    }
  }
}
long long divCeil(long long a, long long b) { return (a + b - 1) / b; }
long long arrceil(vector<long long> a, long long k) {
  long long n = a.size();
  long long low = 0;
  long long high = n - 1;
  if (a[0] > k) return -1;
  while (low < high) {
    long long mid = (low + high + 1) / 2;
    if (a[mid] <= k)
      low = mid;
    else
      high = mid - 1;
  }
  return low;
}