#include <bits/stdc++.h>
using namespace std;
const int maxn = 52;
vector<vector<int> > ans;
vector<int> aa;
vector<int> c;
int n;
void go() {
  vector<int> q;
  int now = n;
  for (int j = aa.size() - 1; j >= 0; j--) {
    now -= aa[j];
    for (int f = now; f < now + aa[j]; f++) {
      q.push_back(c[f]);
    }
  }
  c = q;
}
void go(int x, int y) {
  if (x > 0) {
    aa.push_back(x);
  }
  int lastx = x;
  while (x < n - 1 && c[x] + 1 == c[x + 1]) {
    x++;
  }
  aa.push_back(x - lastx + 1);
  aa.push_back(y - x);
  if (n - 1 - y > 0) aa.push_back(n - 1 - y);
  go();
  ans.push_back(aa);
  aa.clear();
}
void solve() {
  cin >> n;
  c.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  while (true) {
    bool fl = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (c[i] == c[j] + 1) {
          go(i, j);
          fl = 1;
          break;
        }
      }
      if (fl == 1) break;
    }
    if (fl == 0) {
      break;
    }
  }
  cout << ans.size() << endl;
  for (auto x : ans) {
    cout << x.size() << ' ';
    for (auto y : x) cout << y << ' ';
    cout << '\n';
  }
}
signed main() {
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
