#include <bits/stdc++.h>
using namespace std;
const int MAXM = 1000001;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> c(n);
  vector<vector<int> > res;
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  while (!is_sorted(c.begin(), c.end())) {
    if (is_sorted(c.rbegin(), c.rend())) {
      res.push_back(vector<int>(n, 1));
      reverse(c.begin(), c.end());
      continue;
    }
    int pos = find(c.begin(), c.end(), 1) - c.begin();
    int npos = find(c.begin(), c.end(), 2) - c.begin();
    int lb, rb;
    int needReverse;
    int target;
    if (abs(pos - npos) == 1) {
      int sign = pos < npos ? 1 : -1;
      while (npos >= 0 && npos < c.size() && c[npos] == abs(npos - pos) + 1)
        npos += sign;
      npos -= sign;
      needReverse = npos < pos;
      lb = min(pos, npos);
      rb = max(npos, pos);
      target = find(c.begin(), c.end(), c[npos] + 1) - c.begin();
    } else {
      lb = pos;
      rb = pos;
      needReverse = false;
      target = npos;
    }
    pos = lb;
    npos = rb;
    assert(pos != target);
    vector<int> cur;
    if (pos < target && !needReverse) {
      cur.push_back(pos);
      for (int i = 0; i < abs(pos - npos) + 1; i++) cur.push_back(1);
      cur.push_back(target - npos);
      cur.push_back(n - target - 1);
    } else if (pos < target && needReverse) {
      cur.push_back(pos);
      cur.push_back(abs(pos - npos) + 1);
      cur.push_back(target - npos);
      cur.push_back(n - target - 1);
    } else if (pos > target && !needReverse) {
      cur.push_back(target);
      cur.push_back(1);
      cur.push_back(max(pos, npos) - target);
      cur.push_back(n - max(pos, npos) - 1);
    } else {
      cur.push_back(target);
      cur.push_back(min(pos, npos) - target);
      for (int i = 0; i < abs(pos - npos) + 1; i++) cur.push_back(1);
      cur.push_back(n - max(pos, npos) - 1);
    }
    cur.erase(remove_if(cur.begin(), cur.end(), [](int x) { return x == 0; }),
              cur.end());
    res.push_back(cur);
    vector<int> nc;
    int top = 0;
    for (int sz : cur) {
      nc.insert(nc.begin(), c.begin() + top, c.begin() + top + sz);
      top += sz;
    }
    c = nc;
  }
  printf("%d\n", (int)res.size());
  for (const vector<int>& cur : res) {
    printf("%d", (int)cur.size());
    for (int x : cur) printf(" %d", x);
    puts("");
  }
  return 0;
}
