#include <bits/stdc++.h>
using namespace std;
const int N = 55, M = 2e4 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
int n, a[N], b[N];
vector<int> ans[N];
void fun(int tot) {
  int k = n, cnt = 0;
  for (int i = ans[tot].size() - 1; ~i; i--) {
    for (int j = k - ans[tot][i] + 1; j <= k; j++) b[++cnt] = a[j];
    k -= ans[tot][i];
  }
  for (int i = 1; i <= n; i++) a[i] = b[i];
}
int solve() {
  int l = 1, r = n, flag = n % 2, tot = 0, k;
  while (l <= r) {
    k = flag ? l : r;
    ans[tot].clear();
    for (int i = 1; i <= n; i++) {
      if (a[i] < l || a[i] > r)
        ans[tot].push_back(1);
      else {
        int j = i, pos;
        for (; j <= n && a[j] >= l && a[j] <= r; j++)
          if (a[j] == k) pos = j;
        if (pos != i) ans[tot].push_back(pos - i);
        ans[tot].push_back(j - pos);
        i = j - 1;
      }
    }
    if (flag)
      l++;
    else
      r--;
    flag ^= 1;
    if (ans[tot].size() > 1) {
      fun(tot);
      tot++;
    }
  }
  return tot;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int tot = solve();
  printf("%d\n", tot);
  for (int i = 0; i < tot; i++) {
    printf("%d", ans[i].size());
    for (auto j : ans[i]) printf(" %d", j);
    printf("\n");
  }
  return 0;
}
