#include <bits/stdc++.h>
using namespace std;
mt19937 gen(880907);
int n;
int arr[100], pos[100];
vector<vector<int>> ans;
bool check() {
  for (int i = 1; i < n; i++) {
    if (arr[i] < arr[i - 1]) return 0;
  }
  return 1;
}
void oper(vector<int> g) {
  vector<vector<int>> ret;
  for (int i = 0, k = 0; i < g.size(); i++) {
    vector<int> tmp;
    for (int j = 0; j < g[i]; j++) {
      tmp.push_back(arr[k]);
      k++;
    }
    ret.push_back(tmp);
  }
  reverse(ret.begin(), ret.end());
  for (int i = 0, k = 0; i < ret.size(); i++) {
    for (int j = 0; j < ret[i].size(); j++) {
      arr[k] = ret[i][j];
      k++;
    }
  }
  for (int i = 0; i < n; i++) {
    pos[arr[i]] = i;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }
  while (!check())
    for (int i = 2, j = 1; i <= n; i++) {
      if (pos[i] < pos[i - j]) {
        vector<int> op;
        int cnt = 0;
        for (int k = i - 1; k >= 0; i--) {
          if (arr[k] < i && arr[k] > i - j) {
            cnt++;
          } else {
            break;
          }
        }
        if (pos[i] - cnt) {
          op.push_back(pos[i] - cnt);
        }
        int cc = 0;
        for (int k = pos[i] + 1; k < n; k++) {
          if (arr[k] > i) {
            cc++;
            cnt++;
          } else {
            break;
          }
        }
        op.push_back(1 + cnt);
        int aa = 0;
        for (int k = pos[i - j] + 1; k < n; k++) {
          if (arr[k] > i - j && arr[k] < i) {
            aa++;
          } else {
            break;
          }
        }
        op.push_back(pos[i - j] - pos[i] - cc + aa);
        if (n - pos[i - j] - 1 - aa) {
          op.push_back(n - pos[i - j] - 1 - aa);
        }
        ans.push_back(op);
        oper(op);
      }
    }
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].size();
    for (int j = 0; j < ans[i].size(); j++) {
      cout << " " << ans[i][j];
    }
    cout << '\n';
  }
  return 0;
}
