#include <bits/stdc++.h>
using namespace std;
int qwe, qwr;
const long long MOD = 1e9 + 7, MAX = 53;
const int INF = 2e9;
int n, k, tt;
int I = -1, J = -1;
string s;
vector<int> a;
vector<int> v[MAX];
bool ver(int i, int j) {
  for (int i = 1; i < n; i++)
    if (a[tt - 1] == i and a[tt] == j) {
      k = tt - 1;
      return true;
    }
  k = -1;
  return false;
}
bool see(int i, int j) {
  for (int lx = 0; lx < n; lx++) {
    if (a[lx] == i) I = lx;
    if (a[lx] == j) J = lx;
  }
  return (J > I);
}
void simulation(int l, vector<int> vk) {
  vector<int> v1;
  int v2[55];
  v2[0] = 0;
  for (int i = 0; i < l; i++) {
    v2[i + 1] = v2[i] + vk[i];
  }
  for (int i = l - 1; i > -1; i--) {
    for (int j = 0; j < vk[i]; j++) v1.push_back(a[v2[i] + j]);
  }
  a.clear();
  for (auto it : v1) a.push_back(it);
}
void read(vector<int>& a) {
  cin >> qwe;
  a.push_back(qwe);
}
void read2(vector<pair<int, int>>& a) {
  cin >> qwe >> qwr;
  a.push_back({qwe, qwr});
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) read(a);
  int num = 0;
  while (true) {
    int j = 0;
    while (a[j] == j + 1 and j < n) j++;
    if (j == n) break;
    j--;
    if (see(j + 2, j + 3)) {
      v[num].push_back(j + 1);
      v[num].push_back(I - j);
      v[num].push_back(J - I);
      v[num].push_back(n - J - 1);
      simulation(4, v[num]);
      num++;
      v[num].push_back(n - I - 2);
      v[num].push_back(I - j);
      v[num].push_back(1);
      v[num].push_back(j + 1);
      simulation(4, v[num]);
      num++;
    } else if (see(j + 3, j + 2)) {
      if (J != n - 1 or j != -1) {
        v[num].push_back(j + 1);
        v[num].push_back(J - j);
        v[num].push_back(n - 1 - J);
        simulation(3, v[num]);
        num++;
      }
      v[num].push_back(n - 2 - J + I - j);
      v[num].push_back(J - I);
      v[num].push_back(1);
      v[num].push_back(j + 1);
      simulation(4, v[num]);
      num++;
    }
  }
  cout << num << '\n';
  for (int i = 0; i < num; i++) {
    int ga = 0;
    for (auto it : v[i])
      if (it != 0) ga++;
    cout << ga << ' ';
    for (auto it : v[i])
      if (it != 0) cout << it << ' ';
    cout << '\n';
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  cout << '\n';
  return 0;
}
