#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void ran() { srand(chrono::steady_clock::now().time_since_epoch().count()); }
long long get_rand() {
  long long a = rand();
  long long b = rand();
  return a * (RAND_MAX + 1ll) + b;
}
void usaco() {
  freopen("problem.in", "r", stdin);
  freopen("problem.out", "w", stdout);
}
vector<vector<int>> ops;
int arr[55];
int narr[55];
int n;
void enact(vector<int> li) {
  ops.push_back(li);
  int L = 1;
  vector<vector<int>> tr;
  for (auto x : li) {
    int R = L + x - 1;
    vector<int> l;
    for (int j = L; j <= R; j++) l.push_back(j);
    tr.push_back(l);
    L = R + 1;
  }
  reverse(tr.begin(), tr.end());
  int cr = 1;
  for (auto m : tr) {
    for (auto l : m) {
      narr[cr] = arr[l];
      cr++;
    }
  }
  for (int i = 1; i <= n; i++) arr[i] = narr[i];
}
void merger(vector<pair<int, pair<int, int>>> blocks, int l, int r) {
  vector<int> ls;
  int ad = 0;
  for (int i = 0; i < blocks.size(); i++) {
    if (i <= l)
      ls.push_back(blocks[i].first);
    else if (i > r)
      ls.push_back(blocks[i].first);
    else {
      ad += blocks[i].first;
      if (i == r) ls.push_back(ad);
    }
  }
  enact(ls);
}
signed main() {
  ran();
  fast();
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    exit(0);
  }
  for (int i = 1; i <= n; i++) cin >> arr[i];
  bool notk = true;
  while (notk) {
    vector<pair<int, pair<int, int>>> blocks;
    blocks.push_back({1, {arr[1], arr[1]}});
    for (int i = 2; i <= n; i++) {
      if (arr[i] == blocks.back().second.second + 1) {
        blocks.back().second.second = arr[i];
        blocks.back().first++;
      } else {
        blocks.push_back({1, {arr[i], arr[i]}});
      }
    }
    bool need = true;
    for (int i = 0; i < blocks.size(); i++) {
      for (int j = i + 1; j < blocks.size(); j++) {
        if (need && blocks[i].second.first == blocks[j].second.second + 1) {
          need = false;
          merger(blocks, i, j);
        }
      }
    }
    notk = false;
    for (int i = 1; i <= n; i++) {
      if (arr[i] != i) notk = true;
    }
  }
  cout << ops.size() << endl;
  for (auto x : ops) {
    cout << x.size() << ' ';
    for (auto j : x) cout << j << ' ';
    cout << endl;
  }
}
