#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ")";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 55;
int A[N];
int B[N];
int n;
bool sorted() {
  for (int i = 2; i <= n; ++i) {
    if (A[i] < A[i - 1]) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(25);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> A[i];
  }
  vector<vector<int> > v;
  int q = 6;
  while (!sorted()) {
    bool ok = 0;
    vector<int> curr;
    for (int i = 2; i <= n; ++i) {
      int idx = i;
      while (idx < n && A[idx + 1] == A[idx] + 1) ++idx;
      for (int j = 1; j < i; ++j) {
        if (A[j] == A[idx] + 1) {
          if (j > 1) curr.push_back(j - 1);
          curr.push_back(i - j);
          curr.push_back(idx - i + 1);
          if (idx != n) curr.push_back(n - idx);
          ok = 1;
          break;
        }
      }
      if (ok) break;
    }
    assert(ok);
    v.push_back(curr);
    int ptr = n;
    int zz = 1;
    for (int i = curr.size() - 1; i >= 0; --i) {
      ptr -= (curr[i] - 1);
      int tmp = curr[i];
      while (tmp) {
        B[zz++] = A[ptr++];
        --tmp;
      }
      ptr -= curr[i] + 1;
    }
    for (int i = 1; i <= n; ++i) {
      A[i] = B[i];
    }
  }
  cout << v.size() << endl;
  for (auto it : v) {
    cout << it.size();
    for (auto it2 : it) cout << ' ' << it2;
    cout << endl;
  }
}
