#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mxn = 100033;
const int mod = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) f = c == '-' ? -1 : 1, c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * f;
}
inline long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long ksm(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }
void exgcd(long long a, long long b, long long &x, long long &y, long long &d) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, y, x, d);
    y -= x * (a / b);
  }
}
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
int n;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  ;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i], a[i]--;
  vector<vector<int> > res;
  while (!is_sorted(a.begin(), a.end())) {
    vector<int> pos(n);
    for (int i = 0; i < n; ++i) pos[a[i]] = i;
    int x = 0;
    while (x < n && pos[x] < pos[x + 1]) ++x;
    int y = x + 1;
    while (y + 1 < n && pos[y + 1] == pos[y] + 1) ++y;
    vector<int> v;
    if (pos[x + 1]) v.push_back(pos[x + 1]);
    v.push_back(pos[y] - pos[x + 1] + 1);
    v.push_back(pos[x] - pos[y]);
    if (pos[x] < n - 1) v.push_back(n - 1 - pos[x]);
    res.push_back(v);
    vector<int> b;
    for (int i = pos[x] + 1; i < n; ++i) b.push_back(a[i]);
    for (int i = pos[y] + 1; i <= pos[x]; ++i) b.push_back(a[i]);
    for (int i = pos[x + 1]; i <= pos[y]; ++i) b.push_back(a[i]);
    for (int i = 0; i < pos[x + 1]; ++i) b.push_back(a[i]);
    a = b;
  }
  cout << res.size() << endl;
  for (auto v : res) {
    cout << v.size() << " ";
    for (auto e : v) cout << e << " ";
    cout << endl;
  }
  return 0;
}
