#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
int cnt, m, n, a[maxn], b[maxn], c[maxn];
vector<int> op[maxn];
void cl() {
  cnt = 0;
  for (int i = 1; i <= n;) {
    int j = i + 1;
    while (j <= n && a[j] == a[j - 1] + 1) j++;
    b[++cnt] = j - i;
    i = j;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int f = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] != n - i + 1) f = 1;
  }
  if (f == 0 && n >= 2) {
    printf("1\n");
    printf("%d ", n);
    for (int i = 1; i <= n; i++) printf("%d ", 1);
    return 0;
  }
  cl();
  while (cnt != 1) {
    int x = a[1];
    int y = a[1] - 1, p = -1, f = 0;
    if (y == 0) {
      y = a[b[1] + 1] - 1;
      f = 1;
    }
    for (int i = 1; i <= n; i++) {
      if (a[i] == y) {
        p = i;
        break;
      }
    }
    int k = 0;
    if (f) {
      for (int i = p + 1; i <= n; i++) c[++k] = a[i];
      c[++k] = a[p];
      for (int i = b[1] + 1; i < p; i++) c[++k] = a[i];
      for (int i = 1; i <= b[1]; i++) c[++k] = a[i];
      for (int i = 1; i <= n; i++) a[i] = c[i];
      op[++m].push_back(b[1]);
      op[m].push_back(p - 1 - b[1] + 1 - 1);
      op[m].push_back(1);
      if (p + 1 <= n) op[m].push_back(n - p);
      cl();
      continue;
    }
    for (int i = p + 1; i <= n; i++) c[++k] = a[i];
    for (int i = b[1] + 1; i <= p; i++) c[++k] = a[i];
    for (int i = 1; i <= b[1]; i++) c[++k] = a[i];
    for (int i = 1; i <= n; i++) a[i] = c[i];
    op[++m].push_back(b[1]);
    op[m].push_back(p - b[1]);
    if (p + 1 <= n) op[m].push_back(n - p);
    cl();
  }
  assert(m <= n);
  printf("%d\n", m);
  for (int i = 1; i <= m; i++) {
    printf("%d ", op[i].size());
    for (int j : op[i]) printf("%d ", j);
    printf("\n");
  }
}
