#include <bits/stdc++.h>
using namespace std;
const int maxn = 60;
int a[maxn];
int b[maxn];
vector<int> ans[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int cnt = 0;
  int l = 1;
  int r = n;
  int flag = 0;
  if (n % 2) {
    flag = 1;
  }
  int k;
  while (l <= r) {
    if (flag) {
      k = l;
    } else {
      k = r;
    }
    ans[cnt].clear();
    for (int i = 1; i <= n; i++) {
      if (a[i] < l || a[i] > r) {
        ans[cnt].push_back(1);
      } else {
        int pos;
        int j;
        for (j = i; j <= n && a[j] >= l && a[j] <= r; j++) {
          if (a[j] == k) {
            pos = j;
          }
        }
        if (pos != i) {
          ans[cnt].push_back(pos - i);
        }
        ans[cnt].push_back(j - pos);
        i = j - 1;
      }
    }
    if (flag) {
      l++;
    } else {
      r--;
    }
    if (flag) {
      flag = 0;
    } else {
      flag = 1;
    }
    if (ans[cnt].size() > 1) {
      int num = n;
      int tot = 0;
      for (int i = ans[cnt].size() - 1; i != -1; i--) {
        for (int j = num - ans[cnt][i] + 1; j <= num; j++) {
          tot++;
          b[tot] = a[j];
        }
        num -= ans[cnt][i];
      }
      for (int i = 1; i <= n; i++) {
        a[i] = b[i];
      }
      cnt++;
    }
  }
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; i++) {
    printf("%d ", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) {
      printf("%d ", ans[i][j]);
    }
    printf("\n");
  }
  return 0;
}
