#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
int n, a[MAXN];
vector<int> op;
vector<vector<int> > outs;
bool ck() {
  for (int i = 2; i <= n; ++i) {
    if (a[i] < a[i - 1]) return false;
  }
  return true;
}
void swaps(int l, int r) {
  int mid = (l + r) >> 1;
  while (l <= mid) {
    swap(a[l], a[r]);
    ++l;
    --r;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  bool f = 0;
  while (!ck()) {
    op.clear();
    if (f) {
      for (int l = 1; l <= n; ++l) {
        int r = l;
        while (r < n && a[r + 1] > a[r]) ++r;
        swaps(l, r);
        op.push_back(r - l + 1);
        l = r;
      }
    } else {
      for (int l = 1; l <= n; ++l) {
        int r = l;
        while (r < n && a[r + 1] < a[r]) ++r;
        swaps(l, r);
        op.push_back(r - l + 1);
        l = r;
      }
    }
    swaps(1, n);
    f ^= 1;
    if (op.size() != 1) {
      outs.push_back(op);
    }
  }
  printf("%d\n", outs.size());
  for (auto &it : outs) {
    printf("%d", it.size());
    for (auto &i : it) {
      printf(" %d", i);
    }
    printf("\n");
  }
  return 0;
}
