#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 7;
const long long inf = 0x3f3f3f3f3f3f3f;
const long long mod = 20000311;
int n;
vector<int> a(100), b(100);
vector<int> step[100], ves[100];
void solve(int n) {
  int st = 0;
  for (int i = 0; i < step[n].size(); i++) {
    ves[i].clear();
    for (int j = st; j < st + step[n][i]; j++) ves[i].push_back(a[j]);
    st += step[n][i];
  }
  a.clear();
  for (int i = step[n].size() - 1; i >= 0; i--)
    for (auto j : ves[i]) a.push_back(j);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], b[a[i]] = i;
  if (n == 1) {
    cout << 0 << "\n";
    return 0;
  }
  step[1].push_back(b[1]), step[1].push_back(n - b[1]);
  solve(1);
  int flag = n % 2 == 0;
  for (int go = 2; go + flag <= n; go++) {
    if (go % 2 == 0) {
      for (int i = 1; i < go; i++) step[go].push_back(1);
      int cnt = 1;
      while (a[cnt] != go) cnt++;
      if (cnt - go + 2) step[go].push_back(cnt - go + 2);
      if (n - cnt - 1) step[go].push_back(n - cnt - 1);
      solve(go);
    } else {
      int cnt = n - 1;
      while (a[cnt] != go) cnt--;
      if (cnt) step[go].push_back(cnt);
      if (n - go + 1 - cnt) step[go].push_back(n - go + 1 - cnt);
      for (int i = 1; i < go; i++) step[go].push_back(1);
      solve(go);
    }
  }
  int tot = 0, st = 1;
  if (b[1] == 0) st = 2;
  cout << n - flag - st + 1 << "\n";
  for (int i = st; i <= n - flag; i++) {
    cout << step[i].size() << " ";
    for (auto j : step[i]) cout << j << " ";
    cout << "\n";
  }
  return 0;
}
