#include <bits/stdc++.h>
using namespace std;
vector<int> deck, newdeck, deckcopy;
int n, c;
bool runonce = 0;
int f(int x) {
  for (int i = 0; i < n; i++) {
    if (deck[i] == x) {
      return i;
    }
  }
}
void order(int a) {
  int k = 4;
  int p1 = f(a);
  if (f(a) == n - 1) {
    k--;
  }
  if (f(a + 1) == 0) {
    k--;
  }
  if (runonce == 1) {
    cout << k << " ";
    if (f(a + 1) != 0) {
      cout << f(a + 1) << " ";
    }
  }
  while (p1 - 1 - deck[p1 - 1] == f(a) - a) {
    p1--;
  }
  if (runonce == 1) {
    cout << p1 - f(a + 1) << " ";
    cout << f(a) - p1 + 1 << " ";
    if (f(a) != n - 1) {
      cout << n - f(a) - 1 << " ";
    }
    cout << "\n";
  }
  for (int i = f(a) + 1; i < n; i++) {
    newdeck.push_back(deck[i]);
  }
  for (int i = p1; i <= f(a); i++) {
    newdeck.push_back(deck[i]);
  }
  for (int i = f(a + 1); i < p1; i++) {
    newdeck.push_back(deck[i]);
  }
  for (int i = 0; i < f(a + 1); i++) {
    newdeck.push_back(deck[i]);
  }
  deck = newdeck;
  newdeck = {};
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c;
    deck.push_back(c);
    deckcopy.push_back(c);
  }
  int q = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < n; j++) {
      if (f(j) > f(j + 1)) {
        order(j);
        q++;
      }
    }
  }
  runonce = 1;
  cout << q << "\n";
  deck = deckcopy;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < n; j++) {
      if (f(j) > f(j + 1)) {
        order(j);
      }
    }
  }
  return 0;
}
