#include <bits/stdc++.h>
using namespace std;
void testCase() {}
int c[100];
vector<int> ans[100];
int n;
void muokkaa(int q) {
  int ind = n - 1;
  vector<int> v;
  for (int i = ans[q].size() - 1; i >= 0; i--) {
    int x = ans[q][i];
    for (int i = ind - x + 1; i <= ind; i++) {
      v.push_back(c[i]);
    }
    ind -= x;
  }
  for (int i = 0; i < v.size(); i++) c[i] = v[i];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> c[i];
  int cur = 1;
  bool edessa = false;
  int q = 0;
  while (cur < n) {
    int curpos = 0;
    int nextpos = 0;
    for (int i = 0; i < n; i++) {
      if (c[i] == cur) curpos = i;
      if (c[i] == cur + 1) nextpos = i;
    }
    if (edessa) {
      for (int i = 0; i < n; i++) {
        if (c[i] == cur - 1) curpos = i;
      }
      q++;
      if (nextpos > curpos) {
        edessa = true;
        if (curpos + 1 - cur > 0) ans[q].push_back(curpos + 1 - cur);
        ans[q].push_back(1);
        ans[q].push_back(cur - 1);
        ans[q].push_back(nextpos - curpos);
        if (n - 1 - nextpos > 0) ans[q].push_back(n - 1 - nextpos);
      } else {
        edessa = false;
        if (nextpos > 0) ans[q].push_back(nextpos);
        ans[q].push_back(curpos - nextpos - cur + 1);
        ans[q].push_back(1);
        ans[q].push_back(cur - 1);
        if (n - 1 - curpos > 0) ans[q].push_back(n - 1 - curpos);
      }
    } else {
      if (nextpos == curpos + 1) {
        cur++;
        continue;
      }
      q++;
      if (nextpos > curpos) {
        edessa = true;
        if (curpos + 1 - cur > 0) ans[q].push_back(curpos + 1 - cur);
        ans[q].push_back(cur);
        ans[q].push_back(nextpos - curpos);
        if (n - 1 - nextpos > 0) ans[q].push_back(n - 1 - nextpos);
      } else {
        edessa = false;
        if (nextpos > 0) ans[q].push_back(nextpos);
        ans[q].push_back(1);
        ans[q].push_back(curpos - nextpos);
        if (n - 1 - curpos > 0) ans[q].push_back(n - 1 - curpos);
      }
    }
    muokkaa(q);
    cur++;
  }
  if (edessa) {
    q++;
    ans[q].push_back(1);
    ans[q].push_back(n - 1);
  }
  cout << q << "\n";
  for (int i = 1; i <= q; i++) {
    cout << ans[i].size() << " ";
    for (int x : ans[i]) cout << x << " ";
    cout << "\n";
  }
}
