#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) { cout << (expr ? "Yes" : "No") << "\n"; }
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
template <class T>
void chmin(T &a, const T &b) {
  if (b < a) a = b;
}
vector<int> csort(vector<int> &c, vector<int> &tmp) {
  vector<int> ret;
  int ptr = c.size();
  for (int i = (tmp.size()) - 1, i_begin_ = (0); i >= i_begin_; i--) {
    ptr -= tmp[i];
    for (int j = (0), j_end_ = (tmp[i]); j < j_end_; j++)
      ret.push_back(c[ptr + j]);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> c(n);
  for (int i = (0), i_end_ = (n); i < i_end_; i++) cin >> c[i];
  for (int i = (0), i_end_ = (n); i < i_end_; i++) c[i]--;
  int opes = 0;
  vector<vector<int>> ans;
  while (true) {
    bool comp = true;
    for (int i = (0), i_end_ = (n); i < i_end_; i++)
      if (c[i] != i) {
        comp = false;
        break;
      }
    if (comp) break;
    vector<int> tmp;
    for (int i = (0), i_end_ = (opes); i < i_end_; i++) tmp.push_back(1);
    if ((n - opes) % 2 == 0) {
      for (int i = (0), i_end_ = (n); i < i_end_; i++)
        if (c[i] == opes) {
          tmp.push_back(i + 1 - opes);
          if (n - 1 - i > 0) tmp.push_back(n - 1 - i);
          break;
        }
    } else {
      for (int i = (0), i_end_ = (n); i < i_end_; i++)
        if (c[i] == opes) {
          tmp.push_back(n - opes - i);
          if (i > 0) tmp.push_back(i);
          break;
        }
      reverse((tmp).begin(), (tmp).end());
    }
    if (tmp.size() > 1) {
      ans.push_back(tmp);
      c = csort(c, tmp);
    }
    opes++;
  }
  cout << ans.size() << endl;
  for (int i = (0), i_end_ = (ans.size()); i < i_end_; i++) {
    cout << ans[i].size() << " ";
    for (int j = (0), j_end_ = (ans[i].size()); j < j_end_; j++)
      cout << ans[i][j] << (j != ans[i].size() - 1 ? " " : "");
    cout << "\n";
  }
}
