#include <bits/stdc++.h>
using namespace std;
int N;
int C[55];
vector<vector<int>> R;
void hoge(vector<int> A) {
  vector<int> RR;
  vector<vector<int>> B;
  int nex = 0;
  for (auto& a : A)
    if (a) {
      RR.push_back(a);
      B.push_back({});
      while (a--) B.back().push_back(C[nex++]);
    }
  assert(nex == N);
  R.push_back(RR);
  reverse((B.begin()), (B.end()));
  nex = 0;
  for (auto& b : B) {
    for (auto& c : b) C[nex++] = c;
  }
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  for (i = 0; i < (N); i++) cin >> C[i], C[i]--;
  while (1) {
    int P[55] = {};
    vector<vector<int>> V;
    for (i = 0; i < (N); i++) {
      if (V.empty() || C[i - 1] + 1 != C[i]) V.push_back({});
      V.back().push_back(C[i]);
    }
    if (V.size() == 1) break;
    for (y = 0; y < (V.size()); y++)
      for (x = 0; x < (y); x++) {
        if (V[x][0] == V[y].back() + 1) goto out;
      }
  out:
    int D[4] = {};
    for (i = 0; i < (V.size()); i++) {
      if (i < x)
        D[0] += V[i].size();
      else if (i < y)
        D[1] += V[i].size();
      else if (i == y)
        D[2] += V[i].size();
      else
        D[3] += V[i].size();
    }
    hoge({D[0], D[1], D[2], D[3]});
  }
  for (i = 0; i < (N); i++) assert(C[i] == i);
  cout << R.size() << endl;
  for (auto& r : R) {
    cout << r.size();
    for (auto& v : r) cout << " " << v;
    cout << endl;
  }
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
