#include <bits/stdc++.h>
using namespace std;
const long long I1 = 1e9;
const long long I2 = 1e18;
const int32_t M1 = 1e9 + 7;
const int32_t M2 = 998244353;
template <typename T, typename T1>
T maxn(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T minn(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
vector<vector<long long int> > v;
void solve() {
  int n;
  cin >> n;
  vector<long long int> a(n), b(n);
  for (long long int i = 0; i < n; i++) b[i] = i + 1;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  while (1) {
    if (a == b) break;
    int mm = a[n - 1];
    bool cc = false;
    int cnt = 1, cnt1 = 0;
    vector<long long int> vv;
    for (long long int i = n - 1 - 1; i >= 0; i--) {
      if (a[i + 1] - a[i] == 1 && !cc) {
        cnt++;
        continue;
      } else {
        cnt1 += cnt;
        vv.push_back(cnt);
        cc = true;
        if (mm != n) break;
        mm = a[i];
        cnt = 1;
        i--;
        while (a[i + 1] - a[i] == 1 && i >= 0) {
          cnt++;
          i--;
        }
        vv.push_back(cnt);
        cnt1 += cnt;
        break;
      }
    }
    int ind = -1;
    for (long long int i = 0; i < n; i++) {
      if (a[i] == mm + 1) {
        ind = i;
        break;
      }
    }
    vv.push_back(n - cnt1 - ind);
    cnt1 += (n - cnt1 - ind);
    if (cnt1 != n) vv.push_back(n - cnt1);
    vector<long long int> temp;
    int p = n;
    for (auto u : vv) {
      for (int ii = p - u; ii < p; ii++) {
        temp.push_back(a[ii]);
      }
      p -= u;
    }
    reverse(vv.begin(), vv.end());
    v.push_back(vv);
    a.clear();
    a = temp;
  }
  cout << (long long int)v.size() << '\n';
  for (auto u : v) {
    cout << (long long int)u.size() << " ";
    for (auto uu : u) cout << uu << " ";
    cout << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int testcase = 1;
  while (testcase--) solve();
  return 0;
}
