#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& i : a) cin >> i;
  int f = (n & 1);
  vector<vector<int> > ans;
  for (int i = 0; i < n; i++) {
    vector<int> res(1, 0);
    vector<int> tmp;
    int p;
    for (int j = 0; j < n; j++) {
      if (a[j] == i + 1) {
        p = j;
        break;
      }
    }
    if (f) {
      res.push_back(p);
    } else {
      res.push_back(p + 1);
    }
    for (int j = 0; j < n; j++) {
      if (a[j] <= i) {
        res.push_back(j);
        res.push_back(j + 1);
      }
    }
    res.push_back(n);
    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());
    vector<vector<int> > tp(res.size() - 1);
    int now = 0;
    for (int j = 1; j < res.size(); j++) {
      for (int k = res[j - 1]; k < res[j]; k++) tp[j - 1].push_back(a[now++]);
      tmp.push_back(res[j] - res[j - 1]);
    }
    reverse(tp.begin(), tp.end());
    a.clear();
    for (auto i : tp) {
      for (auto j : i) {
        a.push_back(j);
      }
    }
    if (tmp.size() > 1) ans.push_back(tmp);
    f ^= 1;
  }
  cout << ans.size() << '\n';
  for (auto i : ans) {
    cout << i.size();
    for (auto j : i) cout << ' ' << j;
    cout << '\n';
  }
  return 0;
}
