#include <bits/stdc++.h>
using namespace std;
int n;
int tc = 1;
int solve();
int main() {
  if (tc < 1) cin >> tc;
  while (tc--) solve();
  return 0;
}
int solve() {
  cin >> n;
  vector<int> a(n);
  for (auto i = (n) - (n); i < (n); i++) cin >> a[i];
  vector<string> ans;
  for (auto k = (n) - (n); k < (n); k++) {
    int hi = -1, lo = -1, nextlo = -1;
    for (auto i = (n) - (n); i < (n); i++) {
      for (int j = i + 1; j < n; j++)
        if (a[i] == a[j] + 1) {
          hi = i;
          lo = j;
          goto todo;
        }
    }
  todo:
    if (hi == -1) break;
    for (nextlo = hi + 1; a[nextlo] > a[nextlo - 1]; nextlo++) {
    }
    vector<int> segstart, seglen;
    if (hi > 0) {
      segstart.push_back(0);
      seglen.push_back(hi);
    }
    segstart.push_back(hi);
    seglen.push_back(nextlo - hi);
    segstart.push_back(nextlo);
    seglen.push_back(lo - nextlo + 1);
    if (lo < n - 1) {
      segstart.push_back(lo + 1);
      seglen.push_back(n - 1 - lo);
    }
    int s = seglen.size();
    string ansk = "" + to_string(s) + " ";
    for (auto i = (s) - (s); i < (s); i++)
      ansk = ansk + to_string(seglen[i]) + " ";
    ansk = ansk + "\n";
    ans.push_back(ansk);
    auto b = a;
    a.clear();
    for (int i = s - 1; i > -1; i--) {
      for (auto j = (seglen[i]) - (seglen[i]); j < (seglen[i]); j++) {
        a.push_back(b[segstart[i] + j]);
      }
    }
  }
  cout << ans.size() << endl;
  for (auto i = (ans.size()) - (ans.size()); i < (ans.size()); i++)
    cout << ans[i];
  return 0;
}
