#include <bits/stdc++.h>
using namespace std;
const int maxn = 55;
int n;
int a[maxn];
int b[maxn];
vector<vector<pair<int, int> > > ans;
bool check() {
  for (int i = 1; i <= n; ++i)
    if (a[i] != i) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  a[0] = -1e9;
  while (!check()) {
    int flag = false;
    for (int i = 1; i <= n; ++i) {
      int x = a[i];
      for (int j = i; j <= n; ++j) {
        int y = a[j];
        if (x == y + 1) {
          vector<pair<int, int> > tmp;
          int tl = i, tr = j;
          while (a[tl + 1] == a[tl] + 1) ++tl;
          while (a[tr - 1] == a[tr] - 1) --tr;
          memcpy(b, a, sizeof(b));
          int p = 0;
          if (i != 1) tmp.push_back(pair<int, int>(1, i - 1));
          tmp.push_back(pair<int, int>(i, tr - 1));
          tmp.push_back(pair<int, int>(tr, j));
          if (j != n) tmp.push_back(pair<int, int>(j + 1, n));
          ans.push_back(tmp);
          for (int k = tmp.size() - 1; k >= 0; --k) {
            int l = tmp[k].first, r = tmp[k].second;
            for (int z = l; z <= r; ++z) a[++p] = b[z];
          }
          flag = true;
        }
        if (flag) break;
      }
      if (flag) break;
    }
  }
  cout << ans.size() << '\n';
  for (auto i : ans) {
    cout << i.size();
    for (auto j : i) printf(" %d", j.second - j.first + 1);
    puts("");
  }
}
