#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
const long long maxn = 100;
long long mas[maxn], mas2[maxn];
vector<pair<long long, long long> > cur;
vector<pair<long long, long long> > ans[maxn];
void split(long long n) {
  cur.clear();
  long long a, b;
  a = 1, b = 1;
  for (long long i = 2; i <= n; i++) {
    if (mas[i] == mas[i - 1] + 1) {
      b = i;
    } else {
      cur.push_back({a, b});
      a = i, b = i;
    }
  }
  cur.push_back({a, b});
}
signed main() {
  fast();
  long long n, i, j, p, k, a, b;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> mas[i];
  }
  long long x;
  p = 0;
  while (true) {
    split(n);
    long long sz = cur.size();
    if (sz == 1) {
      break;
    }
    p++;
    x = mas[n];
    if (x == n) {
      x = mas[cur[sz - 2].second];
      for (i = 1; i <= n; i++) {
        if (mas[i] == x + 1) {
          if (i != 1) {
            ans[p].push_back({1, i - 1});
          }
          ans[p].push_back({i, cur[sz - 2].first - 1});
          ans[p].push_back(cur[sz - 2]);
          ans[p].push_back(cur[sz - 1]);
          k = 1;
          for (j = cur[sz - 1].first; j <= cur[sz - 1].second; j++) {
            mas2[k] = mas[j];
            k++;
          }
          for (j = cur[sz - 2].first; j <= cur[sz - 2].second; j++) {
            mas2[k] = mas[j];
            k++;
          }
          for (j = i; j <= cur[sz - 2].first - 1; j++) {
            mas2[k] = mas[j];
            k++;
          }
          if (i != 1) {
            for (j = 1; j <= i - 1; j++) {
              mas2[k] = mas[j];
              k++;
            }
          }
          for (k = 1; k <= n; k++) {
            mas[k] = mas2[k];
          }
          break;
        }
      }
    } else {
      for (i = 1; i <= n; i++) {
        if (mas[i] == x + 1) {
          if (i != 1) {
            ans[p].push_back({1, i - 1});
          }
          ans[p].push_back({i, cur[sz - 1].first - 1});
          ans[p].push_back(cur[sz - 1]);
          k = 1;
          for (j = cur[sz - 1].first; j <= cur[sz - 1].second; j++) {
            mas2[k] = mas[j];
            k++;
          }
          for (j = i; j <= cur[sz - 1].first - 1; j++) {
            mas2[k] = mas[j];
            k++;
          }
          if (i != 1) {
            for (j = 1; j <= i - 1; j++) {
              mas2[k] = mas[j];
              k++;
            }
          }
          for (k = 1; k <= n; k++) {
            mas[k] = mas2[k];
          }
          break;
        }
      }
    }
  }
  cout << p << endl;
  for (i = 1; i <= p; i++) {
    cout << ans[i].size() << " ";
    for (j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j].second - ans[i][j].first + 1 << " ";
    }
    cout << endl;
  }
  return 0;
}
