#include <bits/stdc++.h>
using namespace std;
int n, cc = 0;
int arr[53];
vector<vector<int> > ans;
void jumble(int lvl) {
  int aa[n + 1];
  int pntr = 1;
  for (int i = 0; i < ans[lvl].size(); i++) {
    int siz = ans[lvl][i];
    for (int j = pntr; j < pntr + siz; j++) {
      aa[j] = arr[n - siz + 1 - pntr + 1 + j - pntr];
    }
    pntr += siz;
  }
  for (int i = 1; i <= n; i++) arr[i] = aa[i];
}
void solve(int lvl) {
  if (lvl % 2) {
    int ind;
    for (int i = n; i > 0; i--) {
      if (arr[i] == lvl) {
        ind = i;
        break;
      }
    }
    if (lvl == 1 && ind == 1) {
      cc = 1;
      return;
    }
    for (int i = 1; i < lvl; i++) ans[lvl].push_back(1);
    if (n - ind + 1 - lvl + 1) ans[lvl].push_back(n - ind + 1 - lvl + 1);
    if (ind - 1) ans[lvl].push_back(ind - 1);
    jumble(lvl);
    reverse(ans[lvl].begin(), ans[lvl].end());
  } else {
    int ind;
    for (int i = 1; i <= n; i++) {
      if (arr[i] == lvl) {
        ind = i;
        break;
      }
    }
    for (int i = 1; i < lvl; i++) ans[lvl].push_back(1);
    if (ind - lvl + 1) ans[lvl].push_back(ind - lvl + 1);
    if (n - ind) ans[lvl].push_back(n - ind);
    reverse(ans[lvl].begin(), ans[lvl].end());
    jumble(lvl);
    reverse(ans[lvl].begin(), ans[lvl].end());
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  ans.resize(n + 1, vector<int>());
  if (n % 2) {
    for (int i = 1; i <= n; i++) solve(i);
    cout << ans.size() - 1 - cc << endl;
    for (int i = 1 + cc; i < ans.size(); i++) {
      cout << ans[i].size() << " ";
      for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
      cout << endl;
    }
  } else {
    for (int i = 1; i < n; i++) solve(i);
    cout << ans.size() - 2 - cc << endl;
    for (int i = 1 + cc; i < ans.size() - 1; i++) {
      cout << ans[i].size() << " ";
      for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
      cout << endl;
    }
  }
  return 0;
}
