#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 5e1 + 3;
int c[MAX];
int temp[MAX];
int N;
vector<vector<int> > ans;
void reverse(vector<int> v) {
  int start = 1;
  int end = N + 1;
  int size = v.size();
  for (int i = size - 1; i >= 0; i--) {
    int L = v[i];
    end -= L;
    for (int j = 0; j < L; j++) {
      temp[start + j] = c[end + j];
    }
    start += L;
  }
  for (int i = 1; i <= N; i++) {
    c[i] = temp[i];
  }
}
void solve() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> c[i];
  }
  int start = 0;
  int end = 0;
  int next = 0;
  for (int i = 1; i <= N; i++) {
    bool sorted = 1;
    bool reversed = 1;
    for (int j = 1; j <= N; j++) {
      if (c[j] != j) {
        sorted = 0;
      }
      if (c[N - j + 1] != j) {
        reversed = 0;
      }
    }
    if (sorted) {
      break;
    }
    if (reversed) {
      vector<int> v;
      for (int j = 1; j <= N; j++) {
        v.push_back(1);
      }
      ans.push_back(v);
      break;
    }
    for (int j = 1; j <= N; j++) {
      if (c[j] == i) {
        end = j;
      }
      if (c[j] == i + 1) {
        next = j;
      }
      if (c[j] == 1) {
        start = j;
      }
    }
    if (abs(end - next) == 1) {
      continue;
    }
    vector<int> v;
    if (next < end) {
      if (start < end) {
        v.push_back(next - 1);
        v.push_back(start - next);
        v.push_back(end - start + 1);
        v.push_back(N - end);
      } else {
        v.push_back(next - 1);
        v.push_back(end - next);
        for (int j = end; j <= start; j++) {
          v.push_back(1);
        }
        v.push_back(N - start);
      }
    } else {
      if (start < end) {
        v.push_back(start - 1);
        for (int j = start; j <= end; j++) {
          v.push_back(1);
        }
        v.push_back(next - end);
        v.push_back(N - next);
      } else {
        v.push_back(end - 1);
        v.push_back(start - end + 1);
        v.push_back(next - start);
        v.push_back(N - next);
      }
    }
    vector<int> v2;
    for (int a : v) {
      if (a > 0) {
        v2.push_back(a);
      }
    }
    reverse(v2);
    ans.push_back(v2);
  }
  cout << ans.size() << "\n";
  for (vector<int> v : ans) {
    cout << v.size();
    for (int a : v) {
      cout << " " << a;
    }
    cout << "\n";
  }
  return;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
