#include <bits/stdc++.h>
using namespace std;
const long long mx1 = 3e5 + 6, mx2 = 6e3 + 6, mod = 1e9 + 7, lg = 30;
vector<vector<int> > v;
int a[100], pos[100], n;
void solve() {
  vector<int> d = v[v.size() - 1];
  int l = 1;
  for (int i = 0; i < d.size(); i++) {
    reverse(a + l, a + l + d[i]);
    l += d[i];
  }
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) pos[a[i]] = i;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (;;) {
    int x = 0;
    for (int i = n; i >= 2; i--)
      if (pos[i] < pos[i - 1]) {
        x = i;
        break;
      }
    if (x == 0) break;
    vector<int> d;
    if (pos[x] > 1) d.push_back(pos[x] - 1);
    int r = pos[x];
    while (a[r + 1] == a[r] + 1) r++;
    d.push_back(r - pos[x] + 1);
    d.push_back(pos[x - 1] - r);
    if (pos[x - 1] < n) d.push_back(n - pos[x - 1]);
    v.push_back(d);
    solve();
  }
  cout << v.size() << '\n';
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].size() << ' ';
    for (int j = 0; j < v[i].size(); j++) cout << v[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}
