#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> a;
vector<vector<int> > ans;
void put(int x, int y, int z, int w) {
  vector<int> push{x, y, z, w};
  {
    vector<int> npush;
    for (auto x : push)
      if (x) npush.push_back(x);
    push = npush;
  }
  if (((int)(push).size()) >= 2) ans.push_back(push);
  vector<int> na;
  na.reserve(n);
  for (int i = 0; i < (int)(w); i++) na.push_back(a[x + y + z + i]);
  for (int i = 0; i < (int)(z); i++) na.push_back(a[x + y + i]);
  for (int i = 0; i < (int)(y); i++) na.push_back(a[x + i]);
  for (int i = 0; i < (int)(x); i++) na.push_back(a[i]);
  a = na;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  a.resize(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    a[i]--;
  }
  int half = n / 2, off = (n + 1) / 2;
  vector<int> ord;
  for (int i = 0; i < (int)(half); i++) {
    ord.push_back(i + off);
    ord.push_back(i);
  }
  for (int i = 0; i < (int)(((int)(ord).size())); i++) {
    int w = i / 2;
    int z;
    for (int j = 0; j < (int)(n); j++)
      if (a[j] == ord[i]) {
        z = n - j - w;
        break;
      }
    int x = i - w;
    int y = n - x - w - z;
    put(x, y, z, w);
  }
  cout << ((int)(ans).size()) << '\n';
  for (auto &v : ans) {
    cout << ((int)(v).size());
    for (auto x : v) cout << ' ' << x;
    cout << '\n';
  }
  return 0;
}
