#include <bits/stdc++.h>
constexpr int N = 55;
int n;
int a[N], b[N];
std::vector<int> ans[N];
int step;
inline void perform() {
  std::vector<int> index;
  index.push_back(0);
  for (int i : ans[step]) index.push_back(i + index.back());
  std::reverse(index.begin(), index.end());
  int now = 0;
  for (int i = 1; i < index.size(); ++i)
    for (int j = index[i] + 1; j <= index[i - 1]; ++j) b[++now] = a[j];
  for (int i = 1; i <= n; ++i) a[i] = b[i];
}
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(nullptr);
  std::cin >> n;
  for (int i = 1; i <= n; ++i) std::cin >> a[i];
  while (1) {
    int x = 0, y = 0;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j < i; ++j)
        if (a[j] == a[i] + 1) {
          x = j;
          y = i;
          break;
        }
    if (!x && !y) break;
    int t;
    for (int i = x; i < y; ++i)
      if (a[i] > a[i + 1]) {
        t = i;
        break;
      }
    ++step;
    if (x > 1) ans[step].push_back(x - 1);
    ans[step].push_back(t - x + 1);
    ans[step].push_back(y - t);
    if (y < n) ans[step].push_back(n - y);
    perform();
  }
  std::cout << step << '\n';
  for (int i = 1; i <= step; ++i) {
    std::cout << ans[i].size();
    for (int j : ans[i]) std::cout << ' ' << j;
    std::cout << '\n';
  }
  return 0;
}
