#include <bits/stdc++.h>
using namespace std;
const int maxn = 111;
const int M = 1000000007;
int n, k, a[maxn], c[maxn], pos[maxn], pt[maxn];
char s[maxn];
vector<vector<int> > ans;
int check() {
  for (int i = 1; i <= n; i++) pos[a[i]] = i;
  for (int i = 1; i < n; i++)
    if (pos[i] > pos[i + 1]) return i;
  return -1;
}
void work(vector<int> &b) {
  ans.push_back(b);
  int tot = 0, m = b.size();
  for (int i = 0; i < m; i++) pt[i + 1] = pt[i] + b[i];
  for (int i = m - 1; i >= 0; i--)
    for (int j = pt[i] + 1; j <= pt[i + 1]; j++) c[++tot] = a[j];
  for (int i = 1; i <= n; i++) a[i] = c[i];
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  while (check() != -1) {
    int p = check();
    int LL = pos[p + 1] - 1;
    int RR = n - pos[p];
    int L = 1;
    while (p + L < n && pos[p + L] + 1 == pos[p + L + 1]) ++L;
    int R = pos[p] - pos[p + 1] + 1 - L;
    vector<int> res;
    res.clear();
    if (LL) res.push_back(LL);
    res.push_back(L);
    res.push_back(R);
    if (RR) res.push_back(RR);
    work(res);
  }
  printf("%d\n", ans.size());
  for (auto b : ans) {
    printf("%d", b.size());
    for (auto x : b) printf(" %d", x);
    puts("");
  }
  return 0;
}
