#include <bits/stdc++.h>
using namespace std;
int c[53], n, pos[53];
vector<vector<int> > v;
bool sorted() {
  for (int i = 1; i <= n; i++) {
    if (c[i] != i) return 0;
  }
  return 1;
}
vector<int> ret;
int b[53];
void Do() {
  ret.clear();
  for (int i = 2; i <= n; i++) {
    if (pos[i] > pos[i - 1]) continue;
    int suma = 0;
    if (pos[i] != 1) {
      ret.push_back(pos[i] - 1);
      suma += pos[i] - 1;
    }
    int o = 1, x = pos[i - 1];
    for (int j = pos[i] + 1; j < pos[i - 1]; j++) {
      if (c[j] != c[j - 1] + 1) {
        x = j;
        break;
      }
      o++;
    }
    ret.push_back(o);
    suma += o;
    o = 0;
    for (int j = x; j <= pos[i - 1]; j++) {
      o++;
    }
    suma += o;
    ret.push_back(o);
    if (suma < n) ret.push_back(n - suma);
    break;
  }
  v.push_back(ret);
  int sum = 0, cur = 1;
  for (int i = ret.size() - 1; i >= 0; i--) {
    int st = n - sum - ret[i] + 1;
    for (int j = 0; j < ret[i]; j++) {
      b[cur++] = c[st + j];
    }
    sum += ret[i];
  }
  for (int i = 1; i <= n; i++) {
    c[i] = b[i];
    pos[c[i]] = i;
  }
  return;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    pos[c[i]] = i;
  }
  long long op = 0;
  while (true) {
    if (sorted()) {
      break;
    }
    op++;
    if (op > n) return cout << "FUCK" << endl, 0;
    Do();
  }
  cout << op << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].size() << ' ';
    for (int j = 0; j < v[i].size(); j++) {
      cout << v[i][j] << ' ';
    }
    cout << endl;
  }
}
