#include <bits/stdc++.h>
using namespace std;
vector<int> f(vector<int> v, vector<int> bl) {
  int done = 0;
  vector<vector<int>> blocks;
  for (int x : bl) {
    blocks.push_back(vector<int>(v.begin() + done, v.begin() + done + x));
    done += x;
  }
  reverse(blocks.begin(), blocks.end());
  vector<int> ans;
  for (auto v : blocks) ans.insert(ans.end(), v.begin(), v.end());
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<int> st = v;
  vector<vector<int>> ans;
  bool rev = false;
  for (int it = 1; it < n; it++) {
    vector<int> br;
    for (int i = 0; i < n; i++)
      if (i == 0 || ((it % 2) ^ (v[i - 1] > v[i]))) br.push_back(i);
    br.push_back(n);
    vector<int> vv;
    for (int i = 1; i < br.size(); i++) vv.push_back(br[i] - br[i - 1]);
    v = f(v, vv);
    if (vv.size() > 1) ans.push_back(vv);
    rev ^= 1;
  }
  if (rev) {
    ans.push_back(vector<int>(n, 1));
  }
  cout << ans.size() << endl;
  for (auto v : ans) {
    cout << v.size() << " ";
    for (int x : v) cout << x << " ";
    cout << endl;
  }
}
