#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  auto generateBlocks = [&]() {
    vector<vector<int>> bloques;
    int lst = -2;
    vector<int> cur;
    for (int i = 0; i < n; i++) {
      if (lst + 1 != c[i]) {
        if (!cur.empty()) bloques.push_back(cur);
        cur.clear();
      }
      cur.push_back(c[i]);
      lst = c[i];
    }
    if (!cur.empty()) bloques.push_back(cur);
    return bloques;
  };
  auto simulateQuery = [&](const vector<int>& query) {
    vector<vector<int>> bloques;
    int ini = 0;
    for (int i = 0; i < (int)query.size(); i++) {
      int d = query[i];
      assert(d >= 1);
      vector<int> cur(d);
      for (int j = ini; j < ini + d; j++) {
        cur[j - ini] = c[j];
      }
      bloques.push_back(cur);
      ini += d;
    }
    assert(ini == n);
    ini = 0;
    for (int i = (int)bloques.size() - 1; i >= 0; i--) {
      for (int j = 0; j < (int)bloques[i].size(); j++) {
        c[ini + j] = bloques[i][j];
      }
      ini += (int)bloques[i].size();
    }
  };
  vector<vector<int>> res;
  int lst_sz = -1;
  while (true) {
    vector<vector<int>> bloques = generateBlocks();
    int m = (int)bloques.size();
    if (m == 1) break;
    assert(lst_sz == -1 || m < lst_sz);
    lst_sz = m;
    int ini = 0;
    if (bloques[0].front() == 1) ini++;
    int sec = -1;
    for (int i = 0; i < m; i++) {
      if (bloques[i].back() + 1 == bloques[ini].front()) {
        sec = i;
        break;
      }
    }
    assert(sec != -1);
    assert(sec > ini);
    vector<int> query;
    if (ini == 0) {
      query.push_back((int)bloques[0].size());
      int sum = 0;
      for (int i = 1; i <= sec; i++) {
        sum += (int)bloques[i].size();
      }
      query.push_back(sum);
      sum = 0;
      for (int i = sec + 1; i < m; i++) {
        sum += (int)bloques[i].size();
      }
      if (sum) query.push_back(sum);
    } else {
      query.push_back((int)bloques[0].size());
      query.push_back((int)bloques[1].size());
      int sum = 0;
      for (int i = 2; i <= sec; i++) {
        sum += (int)bloques[i].size();
      }
      assert(sum > 0);
      query.push_back(sum);
      sum = 0;
      for (int i = sec + 1; i < m; i++) {
        sum += (int)bloques[i].size();
      }
      if (sum) query.push_back(sum);
    }
    res.push_back(query);
    simulateQuery(query);
  }
  cout << (int)res.size() << endl;
  for (const auto& q : res) {
    cout << (int)q.size();
    for (int i = 0; i < (int)q.size(); i++) {
      cout << " " << q[i];
    }
    cout << endl;
  }
  return 0;
}
