#include <bits/stdc++.h>
using namespace std;
vector<int> get(vector<int> &p, int val) {
  int n = int(p.size());
  vector<int> res;
  for (int i = 0; i < val; ++i) res.push_back(1);
  int cnt = 1;
  for (int i = val; i < n; ++i) {
    if (p[i] != val)
      ++cnt;
    else {
      res.push_back(cnt);
      for (int j = i + 1; j < n; ++j) {
        res.push_back(1);
      }
      break;
    }
  }
  vector<int> newp;
  int cur = n;
  for (int i = int(res.size()) - 1; ~i; --i) {
    vector<int> v;
    for (int j = 0; j < res[i]; ++j) {
      v.push_back(p[--cur]);
    }
    reverse(begin(v), end(v));
    for (auto j : v) newp.push_back(j);
  }
  p = newp;
  return res;
}
void solve() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    --p[i];
  }
  vector<vector<int>> ans;
  for (int i = 0; i < n; ++i) {
    vector<int> v;
    if (i & 1) {
      reverse(begin(p), end(p));
      v = get(p, i);
      reverse(begin(v), end(v));
      reverse(begin(p), end(p));
    } else {
      v = get(p, i);
    }
    if (int(v.size()) > 1) ans.push_back(v);
    bool ok = 1;
    for (int i = 0; i < n - 1; ++i) {
      if (p[i] + 1 != p[i + 1]) ok = 0;
    }
    if (ok) break;
  }
  cout << int(ans.size()) << "\n";
  for (auto i : ans) {
    cout << int(i.size()) << " ";
    for (auto j : i) {
      cout << j << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int tc;
  tc = 1;
  while (tc--) solve();
}
