#include <bits/stdc++.h>
using namespace std;
void doop(vector<long long> &c, vector<long long> op) {
  long long n = c.size();
  vector<long long> tmp = c;
  long long j = 0;
  long long offset = n;
  for (auto opi : op) {
    offset -= opi;
    for (long long ji = j; ji < j + opi; ++ji) {
      tmp[offset + ji - j] = c[ji];
    }
    j += opi;
  }
  copy(tmp.begin(), tmp.end(), c.begin());
}
long long fi(vector<long long> &c, long long tf) {
  for (long long i = 0; i < (long long)c.size(); ++i) {
    if (c[i] == tf) {
      return i;
    }
  }
  return c.size();
}
void ij(vector<long long> &c, vector<vector<long long>> &ops, long long ss) {
  long long n = c.size();
  long long tf = (n / 2) + (n % 2 != 0);
  long long i = fi(c, tf);
  if (i == (long long)c.size() - 1) {
    return;
  }
  ops.push_back({i + 1, n - (i + 1)});
  doop(c, {i + 1, n - (i + 1)});
}
void lj(vector<long long> &c, vector<vector<long long>> &ops, long long ss) {
  long long n = c.size();
  long long tf = c[n - 1] + 1;
  long long i = fi(c, tf);
  if (i == 0) {
    ops.push_back({n - ss, ss});
    doop(c, {n - ss, ss});
  } else {
    ops.push_back({i, n - ss - i, ss});
    doop(c, {i, n - ss - i, ss});
  }
}
void rj(vector<long long> &c, vector<vector<long long>> &ops, long long ss) {
  long long n = c.size();
  long long tf = c[0] - 1;
  long long i = fi(c, tf);
  if (i == n - 1) {
    ops.push_back({ss, n - ss});
    doop(c, {ss, n - ss});
  } else {
    ops.push_back({ss, i + 1 - ss, n - (i + 1)});
    doop(c, {ss, i + 1 - ss, n - (i + 1)});
  }
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> c(n);
  for (auto &ci : c) {
    cin >> ci;
  }
  vector<vector<long long>> ops;
  long long ss = 0;
  ij(c, ops, ss);
  ss++;
  while (ss < n) {
    lj(c, ops, ss);
    ss++;
    if (ss >= n) {
      break;
    }
    rj(c, ops, ss);
    ss++;
  }
  cout << ops.size() << endl;
  for (auto opi : ops) {
    cout << opi.size() << " ";
    for (auto opij : opi) {
      cout << opij << " ";
    }
    cout << endl;
  }
  return 0;
}
