#include <bits/stdc++.h>
using namespace std;
int cmp(const void* a, const void* b) { return *(int*)a - *(int*)b; }
int main() {
  int n;
  scanf("%d", &n);
  int c[n], d[n], pos[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
  }
  vector<vector<int> > ops;
  for (int k = n; k > 1; k--) {
    for (int i = 0; i < n; i++) pos[c[i]] = i;
    int x = -1;
    for (int i = 1; i < n; i++)
      if (pos[i] > pos[i + 1]) {
        x = i;
        break;
      }
    if (x < 0) break;
    vector<int> op;
    if (pos[x + 1] > 0) {
      op.push_back(pos[x + 1]);
    }
    int y = pos[x];
    while (y > pos[x + 1] && c[y] - c[y - 1] == 1) y--;
    op.push_back(y - pos[x + 1]);
    op.push_back(pos[x] + 1 - y);
    if (pos[x] < n - 1) {
      op.push_back(n - 1 - pos[x]);
    }
    ops.push_back(op);
    int lo = 0, hi = n;
    for (int i = 0; i < op.size(); i++) {
      for (int j = 0; j < op[i]; j++) {
        d[hi - op[i] + j] = c[lo + j];
      }
      hi -= op[i];
      lo += op[i];
    }
    for (int i = 0; i < n; i++) c[i] = d[i];
  }
  printf("%d\r\n", (int)ops.size());
  for (int i = 0; i < ops.size(); i++) {
    printf("%d", (int)ops[i].size());
    for (int j = 0; j < ops[i].size(); j++) {
      printf(" %d", ops[i][j]);
    }
    printf("\r\n");
  }
  return 0;
}
