#include <bits/stdc++.h>
using namespace std;
const int ZERO = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  return 0;
}();
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (is_sorted(a.begin(), a.end())) {
    cout << 0;
    return;
  }
  cout << n - (n % 2) - (a.back() == 1) << '\n';
  for (int c = 1 + (a.back() == 1); c <= n - n % 2; ++c) {
    int index = find(a.begin(), a.end(), c) - a.begin();
    deque<int> d(c - 1, 1);
    if (c % 2) {
      d.push_back(index - (c - 1) + 1);
      if (index != n - 1) {
        d.push_back(n - index - 1);
      }
    } else {
      d.push_front(n - c - index + 1);
      if (index) {
        d.push_front(index);
      }
    }
    if (d.size() != 1) {
      cout << d.size() << ' ';
      for (auto x : d) {
        cout << x << ' ';
      }
      cout << '\n';
    }
    vector<int> temp;
    int l = n;
    for (int i = (int)d.size() - 1; i >= 0; --i) {
      l -= d[i];
      int r = l + d[i];
      for (int j = l; j < r; ++j) {
        temp.push_back(a[j]);
      }
    }
    a = move(temp);
  }
}
int main() {
  int q = 1;
  while (q--) {
    solve();
  }
  return 0;
}
