#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  bool HAST = 0;
  if (HAST) {
    int t;
    cin >> t;
    for (int tt = 0, _tt = (t); tt < _tt; ++tt) {
      solve();
      cout << '\n';
    }
  } else {
    solve();
  }
}
void applymove(vector<int>& a, vector<int>& move) {
  vector<int> b(int((a).size()));
  if (int((move).size()) == 2) {
    for (int i = 0, _i = (move[1]); i < _i; ++i) {
      b[i] = a[i + move[0]];
    }
    for (int i = 0, _i = (move[0]); i < _i; ++i) {
      b[i + move[1]] = a[i];
    }
  } else if (int((move).size()) == 3) {
    for (int i = 0, _i = (move[2]); i < _i; ++i) {
      b[i] = a[i + move[0] + move[1]];
    }
    for (int i = 0, _i = (move[1]); i < _i; ++i) {
      b[i + move[2]] = a[i + move[0]];
    }
    for (int i = 0, _i = (move[0]); i < _i; ++i) {
      b[i + move[2] + move[1]] = a[i];
    }
  } else {
    for (int i = 0, _i = (move[3]); i < _i; ++i) {
      b[i] = a[i + move[0] + move[1] + move[2]];
    }
    for (int i = 0, _i = (move[2]); i < _i; ++i) {
      b[i + move[3]] = a[i + move[0] + move[1]];
    }
    for (int i = 0, _i = (move[1]); i < _i; ++i) {
      b[i + move[3] + move[2]] = a[i + move[0]];
    }
    for (int i = 0, _i = (move[0]); i < _i; ++i) {
      b[i + move[3] + move[2] + move[1]] = a[i];
    }
  }
  for (int i = 0, _i = (int((a).size())); i < _i; ++i) a[i] = b[i];
}
bool iscomplete(vector<int>& a) {
  for (int i = 0, _i = (int((a).size())); i < _i; ++i) {
    if (a[i] != i + 1) return 0;
  }
  return 1;
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0, _i = (n); i < _i; ++i) cin >> a[i];
  bool complete = 0;
  vector<vector<int> > moves;
  if (n == 1) {
    cout << 0;
    return;
  }
  complete = iscomplete(a);
  while (!complete) {
    int notouch = 0;
    while (a[notouch] == notouch + 1) notouch++;
    vector<int> move;
    if (notouch > 0) move.push_back(notouch);
    int firstout = notouch;
    while (a[firstout + 1] == a[firstout] + 1) firstout++;
    move.push_back(firstout + 1 - notouch);
    int previ = firstout;
    while (a[previ] != a[notouch] - 1) previ++;
    move.push_back(previ - firstout);
    if (previ < n - 1) move.push_back(n - previ - 1);
    applymove(a, move);
    complete = iscomplete(a);
    moves.push_back(move);
  }
  cout << int((moves).size()) << '\n';
  for (int i = 0, _i = (int((moves).size())); i < _i; ++i) {
    cout << int((moves[i]).size()) << ' ';
    for (int j = 0, _j = (int((moves[i]).size())); j < _j; ++j)
      cout << moves[i][j] << ' ';
    cout << '\n';
  }
}
