#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long &x : a) {
    cin >> x;
  }
  vector<vector<long long>> ans;
  auto apply = [&](vector<long long> op) {
    vector<long long> new_a;
    for (long long i = (long long)op.size() - 1; i >= 0; i--) {
      long long m = op[i];
      vector<long long> tmp(a.end() - m, a.end());
      a.resize(a.size() - m);
      new_a.insert(new_a.end(), tmp.begin(), tmp.end());
    }
    a = new_a;
    ans.push_back(op);
  };
  while (!is_sorted(a.begin(), a.end())) {
    for (long long i = 2; i <= n; i++) {
      long long cur_pos = find(a.begin(), a.end(), i) - a.begin();
      long long pv_pos = find(a.begin(), a.end(), i - 1) - a.begin();
      if (cur_pos < pv_pos) {
        vector<long long> op;
        long long lm = pv_pos;
        while (a[lm - 1] == a[lm] - 1) lm--;
        if (cur_pos != 0) op.push_back(cur_pos);
        op.push_back(lm - cur_pos);
        op.push_back(pv_pos - lm + 1);
        if (pv_pos != n - 1) op.push_back(n - 1 - pv_pos);
        apply(op);
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto ls : ans) {
    cout << ls.size() << " ";
    for (long long x : ls) {
      cout << x << " ";
    }
    cout << "\n";
  }
}
