#include <bits/stdc++.h>
using namespace std;
const long long zero = 0;
const long long one = 1;
const long long INF = 9223372036854775807;
const int inINF = 2147483647;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
void Yes() { printf("Yes\n"); }
void No() { printf("No\n"); }
void YES() { printf("YES\n"); }
void NO() { printf("NO\n"); }
int main() {
  int n;
  cin >> n;
  vector<vector<int>> ans;
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    c[i]--;
  }
  int maxint, maxind, minint, minind;
  while (true) {
    bool check = true;
    for (int i = 0; i < n; i++) {
      if (c[i] != i) {
        check = false;
        break;
      }
    }
    if (check) break;
    bool ex, fin;
    fin = false;
    for (int i = 0; i < n - 1; i++) {
      ex = false;
      for (int j = 0; j < n; j++) {
        if (c[j] == i + 1) {
          ex = true;
        } else if (c[j] == i) {
          if (ex == false) {
            break;
          } else {
            maxint = i + 1;
            minint = i;
            fin = true;
            break;
          }
        }
      }
      if (fin) break;
    }
    int minlas, maxsta;
    for (int i = 0; i < n; i++) {
      if (c[i] == minint) {
        minlas = i;
      } else if (c[i] == maxint) {
        maxsta = i;
      }
    }
    minind = 0;
    for (int i = minlas; i > 0; i--) {
      if (c[i - 1] + 1 != c[i]) {
        minind = i;
        break;
      }
    }
    maxind = n - 1;
    for (int i = maxsta; i < n - 1; i++) {
      if (c[i] + 1 != c[i + 1]) {
        maxind = i;
        break;
      }
    }
    vector<int> d;
    if (maxsta == 0 && minlas == n - 1) {
      ans.push_back({minind - maxsta, minlas - minind + 1});
      for (int i = minind; i < n; i++) {
        d.push_back(c[i]);
      }
      for (int i = 0; i < minind; i++) {
        d.push_back(c[i]);
      }
    } else if (maxsta == 0) {
      ans.push_back({minind - maxsta, minlas - minind + 1, n - 1 - minlas});
      for (int i = minlas + 1; i < n; i++) {
        d.push_back(c[i]);
      }
      for (int i = minind; i < minlas + 1; i++) {
        d.push_back(c[i]);
      }
      for (int i = 0; i < minind; i++) {
        d.push_back(c[i]);
      }
    } else if (minlas == n - 1) {
      ans.push_back({maxsta, minind - maxsta, n - minind});
      for (int i = minind; i < n; i++) {
        d.push_back(c[i]);
      }
      for (int i = maxsta; i < minind; i++) {
        d.push_back(c[i]);
      }
      for (int i = 0; i < maxsta; i++) {
        d.push_back(c[i]);
      }
    } else {
      ans.push_back(
          {maxsta, minind - maxsta, minlas - minind + 1, n - minlas - 1});
      for (int i = minlas + 1; i < n; i++) {
        d.push_back(c[i]);
      }
      for (int i = minind; i < minlas + 1; i++) {
        d.push_back(c[i]);
      }
      for (int i = maxsta; i < minind; i++) {
        d.push_back(c[i]);
      }
      for (int i = 0; i < maxsta; i++) {
        d.push_back(c[i]);
      }
    }
    for (int i = 0; i < n; i++) {
      c[i] = d[i];
    }
  }
  int q = ans.size();
  printf("%d\n", q);
  for (int i = 0; i < q; i++) {
    int k = ans[i].size();
    printf("%d ", k);
    for (int j = 0; j < ans[i].size() - 1; j++) {
      printf("%d ", ans[i][j]);
    }
    printf("%d\n", ans[i][ans[i].size() - 1]);
  }
}
