#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  vector<int> id, arr;
  int n;
  void flip(int left) {
    int right = n - left;
    for (int i = 0; i < n; i++) {
      if (id[i] < left)
        id[i] += right;
      else
        id[i] -= left;
    }
  }
  void flip(int c1, int c2) {
    if (c1 + c2 == n) {
      flip(c1);
      return;
    }
    int c3 = n - c1 - c2;
    for (int i = 0; i < n; i++) {
      if (id[i] < c1)
        id[i] += c2 + c3;
      else if (id[i] < c1 + c2)
        id[i] += -c1 + c3;
      else
        id[i] -= c1 + c2;
    }
  }
  void solve(int num, std::istream& in, std::ostream& out) {
    in >> n;
    arr.resize(n), id.resize(n);
    bool was = true;
    for (int i = 0; i < n; i++) {
      in >> arr[i];
      if (i && arr[i] < arr[i - 1]) was = false;
      id[arr[i] - 1] = i;
    }
    if (was) {
      out << 0;
      return;
    }
    int mid = n / 2;
    int gr = 1;
    int d = 0;
    int lo = mid;
    int hi = mid;
    vector<vector<int>> log;
    if (id[mid] != 0) {
      int cnt = id[mid];
      log.push_back({2, cnt, n - cnt});
      flip(cnt);
    }
    while (gr < n) {
      if (d == 0) {
        lo--;
        if (id[lo] == n - 1) {
          log.push_back({2, gr, n - gr});
          flip(gr);
        } else {
          log.push_back({3, gr, 1 + id[lo] - gr, n - 1 - id[lo]});
          flip(gr, 1 + id[lo] - gr);
        }
      } else {
        hi++;
        if (id[hi] == 0) {
          log.push_back({2, n - gr, gr});
          flip(n - gr);
        } else {
          log.push_back({3, id[hi], n - gr - id[hi], gr});
          flip(id[hi], n - gr - id[hi]);
        }
      }
      gr++;
      d ^= 1;
    }
    out << log.size() << endl;
    for (auto& vt : log) {
      for (int v : vt) {
        out << v << " ";
      }
      out << endl;
    }
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(0, in, out);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
