#include <bits/stdc++.h>
using namespace std;
double pi = 2 * acos(0.0);
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '{';
  for (const auto &x : v) os << " " << x;
  return os << '}';
}
int n;
vector<int> v, ans[55];
void solve(int kk) {
  int sz = ans[kk].size();
  vector<int> t[sz], v1;
  int ix = 0, cc = 0;
  for (int i = 0; i < sz; i++) {
    for (ix, cc = 0; cc < ans[kk][i]; ix++, cc++) {
      t[i].push_back(v[ix]);
    }
  }
  v.clear();
  for (int i = sz - 1; i >= 0; i--) {
    for (int j = 0; j < t[i].size(); j++) {
      v.push_back(t[i][j]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  int in;
  for (int i = 0; i < n; i++) {
    cin >> in;
    v.push_back(in);
  }
  int kk = 0;
  while (true) {
    int ix1 = -1, ix2 = -1;
    map<int, int> mp, ixs;
    for (int i = 0; i < n; i++) {
      mp[v[i]]++;
      ixs[v[i]] = i;
      if (mp[v[i] + 1]) {
        ix1 = ixs[v[i]];
        ix2 = ixs[v[i] + 1];
        mp.clear();
        ixs.clear();
        break;
      }
    }
    if (ix2 == -1 && ix1 == -1) break;
    int x = 1;
    if (ix2) ans[kk].push_back(ix2);
    x = 1;
    for (int j = ix2 + 1; j < ix1; j++) {
      if (v[j] > v[j - 1]) {
        x++;
        ix2 = j;
      } else {
        break;
      }
    }
    ans[kk].push_back(x);
    ans[kk].push_back(ix1 - ix2);
    if (n - 1 - ix1) ans[kk].push_back(n - 1 - ix1);
    solve(kk);
    kk++;
  }
  cout << kk << endl;
  for (int i = 0; i < kk; i++) {
    cout << ans[i].size() << " ";
    for (auto it : ans[i]) cout << it << " ";
    cout << endl;
  }
  return 0;
}
