#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
int arr[MAXN];
int b[MAXN];
vector<pair<pair<int, int>, pair<int, int>>> res;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  while (true) {
    bool ok = true;
    for (int i = 1; i <= n; i++) {
      if (arr[i] != i) {
        ok = false;
        break;
      }
    }
    if (ok) {
      break;
    }
    int ind1 = -1;
    int ind2 = -1;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (arr[i] == arr[j] + 1) {
          ind1 = i;
          ind2 = j;
          break;
        }
      }
      if (ind1 != -1) {
        break;
      }
    }
    int splitat = ind1;
    for (int i = ind1; i < ind2; i++) {
      if (arr[i] > arr[i + 1]) {
        splitat = i;
      }
    }
    int ind = 1;
    for (int i = ind2 + 1; i <= n; i++) {
      b[ind] = arr[i];
      ind++;
    }
    for (int i = splitat + 1; i <= ind2; i++) {
      b[ind] = arr[i];
      ind++;
    }
    for (int i = ind1; i <= splitat; i++) {
      b[ind] = arr[i];
      ind++;
    }
    for (int i = 1; i < ind1; i++) {
      b[ind] = arr[i];
      ind++;
    }
    for (int i = 1; i <= n; i++) {
      arr[i] = b[i];
    }
    res.push_back(make_pair(make_pair(ind1 - 1, splitat - ind1 + 1),
                            make_pair(ind2 - splitat, n - ind2)));
  }
  cout << res.size() << endl;
  for (auto x : res) {
    int cnt = 0;
    if (x.first.first) {
      cnt++;
    }
    if (x.first.second) {
      cnt++;
    }
    if (x.second.first) {
      cnt++;
    }
    if (x.second.second) {
      cnt++;
    }
    cout << cnt << endl;
    if (x.first.first) {
      cout << x.first.first << " ";
    }
    if (x.first.second) {
      cout << x.first.second << " ";
    }
    if (x.second.first) {
      cout << x.second.first << " ";
    }
    if (x.second.second) {
      cout << x.second.second << " ";
    }
    cout << endl;
  }
}
