#include <bits/stdc++.h>
using namespace std;
void print(vector<int> v) {
  for (int e : v) cout << e << " ";
  cout << endl;
}
int main() {
  int N, start, end;
  cin >> N;
  vector<int> v(N);
  int history[N][2];
  for (int i = 0; i < N; i++) cin >> v[i];
  int i;
  for (i = 0; i < N; i++) {
    int start, end;
    for (start = 1; start < N; start++)
      if (v[start] != v[start - 1] % N + 1) break;
    if (start == N) break;
    for (end = start; end < N; end++)
      if (v[end] == (v[0] + N - 2) % N + 1) break;
    history[i][0] = start;
    history[i][1] = ++end;
    vector<int> tmp(v.begin() + end, v.end());
    tmp.insert(tmp.end(), v.begin() + start, v.begin() + end);
    tmp.insert(tmp.end(), v.begin(), v.begin() + start);
    v = tmp;
  }
  cout << i + (v[0] != 1) << endl;
  for (int j = 0; j < i; j++) {
    start = history[j][0], end = history[j][1];
    if (end == N)
      cout << "2 " << start << " " << N - start << endl;
    else
      cout << "3 " << start << " " << end - start << " " << N - end << endl;
  }
  if (v[0] != 1) cout << "2 " << N - v[0] + 1 << " " << v[0] - 1 << endl;
}
