#include <bits/stdc++.h>
using namespace std;
template <typename T>
void setmax(T& x, T y) {
  x = max(x, y);
}
template <typename T>
void setmin(T& x, T y) {
  x = min(x, y);
}
template <typename T>
void print(const T& a, ostream& out) {
  for (auto i : a) out << i << ' ';
  out << endl;
}
const double PI = acos(-1.0);
const long long INF = 1e9 + 47;
const long long LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> go(vector<int> x) {
  vector<int> y;
  for (auto i : x)
    if (i) y.push_back(i);
  return y;
}
void roby(vector<int>& a, vector<int> x) {
  vector<vector<int>> b;
  vector<int> curr;
  int ptr = 0;
  for (auto i : a) {
    curr.push_back(i);
    if ((int)((curr).size()) == x[ptr]) {
      b.push_back(curr);
      curr.clear();
      ptr++;
    }
  }
  reverse(b.begin(), b.end());
  a.clear();
  for (auto i : b)
    for (auto j : i) a.push_back(j);
}
int is_shift(vector<int>& a, int n) {
  for (int i = (0); i < (n); ++i)
    if (a[i] == 0) {
      for (int j = (1); j < (n); ++j)
        if (a[(i + j) % n] != a[(i + j - 1) % n] + 1) {
          return -1;
        }
      return i;
    }
  assert(false);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = (0); i < (n); ++i) cin >> a[i], a[i]--;
  vector<vector<int>> ans;
  while (true) {
    vector<int> pos(n);
    for (int i = (0); i < (n); ++i) pos[a[i]] = i;
    int id = -1;
    for (int i = (1); i < (n); ++i) {
      if (pos[i] < pos[i - 1]) {
        id = i;
        break;
      }
    }
    if (id == -1) {
      break;
    }
    int xxx = is_shift(a, n);
    if (xxx != -1) {
      ans.push_back({xxx, n - xxx});
      roby(a, ans.back());
      break;
    }
    int len = 1;
    while (a[pos[id] + len] == a[pos[id] + len - 1] + 1) len++;
    vector<int> x = go(
        {pos[id], len, pos[id - 1] - pos[id] - len + 1, n - pos[id - 1] - 1});
    ans.push_back(x);
    roby(a, ans.back());
  }
  assert((int)((ans).size()) <= n);
  cout << (int)((ans).size()) << endl;
  for (auto i : ans) {
    cout << (int)((i).size());
    for (auto j : i) cout << ' ' << j;
    cout << endl;
  }
  cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
