#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void debug(...) {}
const int maxn = 300010;
int n, a[maxn];
vector<vector<int>> res;
bool get(int x) {
  for (int i = 1; i < n; ++i)
    if (a[i] == x && a[i + 1] == x + 1) return false;
  int px = -1, pn = -1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == x) px = i;
    if (a[i] == x + 1) pn = i;
  }
  if (px < pn) return false;
  int pnn = pn;
  while (pnn + 1 <= n && a[pnn + 1] == a[pnn] + 1) ++pnn;
  vector<int> ad;
  if (pn != 1) ad.emplace_back(pn - 1);
  ad.emplace_back(pnn - pn + 1);
  ad.emplace_back(px - pnn);
  if (px != n) ad.emplace_back(n - px);
  res.emplace_back(ad);
  vector<vector<int>> vs;
  for (int h = 1, i = 0; i < ad.size(); ++i) {
    vs.emplace_back(a + h, a + h + ad[i]);
    h += ad[i];
  }
  reverse(begin(vs), end(vs));
  for (int h = 1, i = 0; i < vs.size(); ++i) {
    for (int j : vs[i]) a[h++] = j;
  }
  debug(a + 1, a + 1 + n);
  return true;
}
void solve() {
  bool kep = true;
  while (kep) {
    kep = false;
    for (int i = 1; i < n; ++i) kep |= get(i);
  }
  for (int i = 1; i <= n; ++i) assert(a[i] == i);
  cout << res.size() << '\n';
  for (auto V : res) {
    cout << V.size();
    for (int u : V) cout << ' ' << u;
    cout << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  solve();
}
