#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
inline int add(int a, int b) {
  a += b;
  return a >= 1000000007 ? a - 1000000007 : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + 1000000007 : a;
}
inline int mul(int a, int b) { return (long long int)a * b % 1000000007; }
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Cheek(int N, int pos) { return (bool)(N & (1 << pos)); }
int ara[60];
void Solve(int t) {
  int i, j, k, n, pos1 = -1, pos2 = -1, pos3 = -1, pos4 = -1;
  deque<int> dq1, dq2, dq3, dq4;
  vector<vector<int> > ans;
  scanf("%d", &(n));
  for (i = 1; i <= n; i++) scanf("%d", &(ara[i]));
  int ncopy = n;
  while (ncopy--) {
    for (i = 1; i < n; i++) {
      pos1 = pos2 = -1;
      dq1.clear();
      dq2.clear();
      dq3.clear();
      dq4.clear();
      for (j = i + 1; j <= n; j++) {
        if (ara[i] == 1 + ara[j]) {
          pos1 = i;
          pos2 = j;
          break;
        }
      }
      if (pos1 == -1 && pos2 == -1) continue;
      for (k = pos1; k < pos2; k++) {
        if (ara[k] > ara[k + 1]) {
          pos3 = k;
          break;
        }
      }
      for (j = 1; j < pos1; j++) dq1.push_back(ara[j]);
      for (j = pos1; j <= pos3; j++) dq2.push_back(ara[j]);
      for (j = pos3 + 1; j <= pos2; j++) dq3.push_back(ara[j]);
      for (j = pos2 + 1; j <= n; j++) dq4.push_back(ara[j]);
      vector<int> temp;
      int pos = 1;
      if (dq4.size() > 0) {
        temp.push_back(dq4.size());
        while (!dq4.empty()) {
          ara[pos++] = dq4.front();
          dq4.pop_front();
        }
      }
      if (dq3.size() > 0) {
        temp.push_back(dq3.size());
        while (!dq3.empty()) {
          ara[pos++] = dq3.front();
          dq3.pop_front();
        }
      }
      if (dq2.size() > 0) {
        temp.push_back(dq2.size());
        while (!dq2.empty()) {
          ara[pos++] = dq2.front();
          dq2.pop_front();
        }
      }
      if (dq1.size() > 0) {
        temp.push_back(dq1.size());
        while (!dq1.empty()) {
          ara[pos++] = dq1.front();
          dq1.pop_front();
        }
      }
      reverse(temp.begin(), temp.end());
      ;
      if (!temp.empty()) {
        ans.push_back(temp);
        break;
      }
    }
  }
  cout << ans.size() << endl;
  for (i = 0; i < (int)ans.size(); i++) {
    cout << ans[i].size();
    for (auto x : ans[i]) cout << ' ' << x;
    cout << endl;
  }
}
int main() {
  int t, T;
  T = 1;
  for (__typeof(t) t = 1; t <= T; t++) {
    Solve(t);
  }
  return 0;
}
