#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const vector<int> mods = {998244353, 1000000007, 1000000009};
const long long inf = 3e18;
const double pi = acos(-1.0);
const double eps = 0.0000001;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class... K>
using umap = unordered_map<K...>;
template <class... K>
using uset = unordered_set<K...>;
const int N = 100;
long long n, a[N], idx[N];
bool rev;
vector<vector<long long> > res;
void hp(int i, int j, int d = 0) {
  if (i > j) return;
  if (!d) res.back().push_back(j - i + 1);
  while (i < j) {
    swap(idx[a[i]], idx[a[j]]);
    swap(a[i], a[j]);
    i++;
    j--;
  }
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(13);
  cin >> n;
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i];
    a[i]--;
    idx[a[i]] = i;
  }
  for (long long i = (0); i < (n - 1); ++i) {
    res.push_back({});
    if (idx[i] == i) {
      for (long long j = (0); j < (n); ++j) hp(j, j);
      continue;
    }
    if (i) {
      long long pr = idx[i - 1];
      long long cur = idx[i];
      for (long long k = (0); k < (pr + 1); ++k) {
        hp(k, k);
      }
      hp(pr + 1, cur);
      hp(cur + 1, n - 1);
    }
    if (!i) {
      long long cur = idx[i];
      if (cur == n - 1) {
        rev = 1;
        hp(0, n - 1, 1);
      } else {
        hp(0, cur);
        hp(cur + 1, n - 1);
      }
    }
  }
  if (((int)(res).size()) % 2 == 1) {
    res.push_back({});
    for (long long i = (0); i < (n); ++i) hp(i, i);
  }
  cout << ((int)(res).size()) - rev << "\n";
  for (long long i = (0); i < (((int)(res).size())); ++i) {
    if (!((int)(res[i]).size())) continue;
    cout << ((int)(res[i]).size()) << " ";
    for (long long j = (0); j < (((int)(res[i]).size())); ++j)
      cout << res[i][i % 2 == 1 ? ((int)(res[i]).size()) - 1 - j : j] << " ";
    cout << "\n";
  }
  return 0;
}
