#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 55;
int n;
int a[N];
vector<vector<int> > ans;
void ubd(vector<int> v) {
  vector<int> vv;
  for (int i = 0; i < ((int)(v).size()); ++i) {
    if (v[i]) vv.push_back(v[i]);
  }
  v = vv;
  if (((int)(v).size()) == 1) return;
  ans.push_back(v);
  vector<vector<int> > u;
  int s = 1;
  for (int i = 0; i < ((int)(v).size()); ++i) {
    vector<int> t;
    for (int j = s; j < s + v[i]; ++j) t.push_back(a[j]);
    u.push_back(t);
    s += v[i];
  }
  reverse((u).begin(), (u).end());
  s = 1;
  for (int i = 0; i < ((int)(u).size()); ++i) {
    for (int j = 0; j < ((int)(u[i]).size()); ++j) a[s++] = u[i][j];
  }
}
void solv() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  while (1) {
    bool z = true;
    for (int i = 1; i < n; ++i) {
      if (a[i + 1] != (a[i] % n + 1)) {
        z = false;
        break;
      }
    }
    if (z) break;
    int u;
    if (a[1] == 1)
      u = n;
    else
      u = a[1] - 1;
    for (int i = 1; i <= n; ++i) {
      if (a[i] == u) {
        for (int j = i;; --j) {
          if (a[j] != (a[j - 1] % n + 1)) {
            ubd({j - 1, i - j + 1, n - i});
            break;
          }
        }
        break;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (a[i] == 1) {
      ubd({i - 1, n - i + 1});
      break;
    }
  }
  printf("%d\n", ((int)(ans).size()));
  for (int i = 0; i < ((int)(ans).size()); ++i) {
    printf("%d ", ((int)(ans[i]).size()));
    for (int j = 0; j < ((int)(ans[i]).size()); ++j) printf("%d ", ans[i][j]);
    printf("\n");
  }
}
int main() {
  solv();
  return 0;
}
