#include <bits/stdc++.h>
using namespace std;
const int N = 200020;
const int MOD = 1e9 + 7;
const double EPS = 1e-6;
const double PI = acos(-1);
int n;
int a[55], b[55];
vector<vector<int>> ans;
void update(vector<int> ve) {
  int t = 1, tt = n;
  for (auto i : ve) {
    for (int j = tt - i + 1; j <= tt; j++) b[j] = a[t++];
    tt -= i;
  }
  for (int i = 1; i <= n; i++) a[i] = b[i];
}
void go(int t, bool f) {
  vector<int> res;
  int pos = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == t) {
      pos = i;
      break;
    }
  }
  if (f) {
    for (int i = 1; i < t; i++) res.push_back(1);
    int s1 = pos - (t - 1), s2 = n - (t - 1) - s1;
    if (s1) res.push_back(s1);
    if (s2) res.push_back(s2);
  } else {
    int s1 = pos - 1, s2 = n - (t - 1) - s1;
    if (s1) res.push_back(s1);
    if (s2) res.push_back(s2);
    for (int i = 1; i < t; i++) res.push_back(1);
  }
  if ((int)res.size() == 1) return;
  update(res);
  ans.push_back(res);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    go(i, i & 1);
    if (is_sorted(a + 1, a + 1 + n)) break;
  }
  if (!is_sorted(a + 1, a + 1 + n)) {
    vector<int> tmp;
    for (int i = 1; i <= n; i++) tmp.push_back(1);
    ans.push_back(tmp);
  }
  cout << (int)ans.size() << "\n";
  for (auto i : ans) {
    cout << (int)i.size();
    for (auto j : i) cout << " " << j;
    cout << "\n";
  }
}
