#include <bits/stdc++.h>
using namespace std;
const long long max_n = 55;
const long long inf = 1e18 + 10;
long long n, c[max_n];
vector<vector<long long> > operations;
void apply(vector<long long> D) {
  vector<vector<long long> > curr;
  long long i = 0;
  for (long long d : D) {
    vector<long long> t;
    for (long long w = 0; w < d; w++) {
      t.push_back(c[i++]);
    }
    curr.push_back(t);
  }
  reverse(curr.begin(), curr.end());
  i = 0;
  for (long long k = 0; k < curr.size(); k++) {
    for (long long x : curr[k]) {
      c[i] = x;
      i++;
    }
  }
  return;
}
bool do_forward() {
  long long i = 1;
  vector<long long> current;
  while (i < n && c[i] - c[i - 1] == 1) {
    current.push_back(1);
    i++;
  }
  current.push_back(1);
  i++;
  if (i > n) return 1;
  for (long long j = 0; j < n; j++) {
    if (c[j] == i) {
      current.push_back(j + 1 - (i - 1));
      long long rem = (n - (j + 1));
      if (rem > 0) current.push_back(rem);
      break;
    }
  }
  apply(current);
  operations.push_back(current);
  return 0;
}
bool do_backward() {
  long long i = n - 2;
  vector<long long> current;
  while (i >= 0 && c[i] - c[i + 1] == 1) {
    current.push_back(1);
    i--;
  }
  current.push_back(1);
  i = current.size() + 1;
  if (i > n) return 1;
  for (long long j = n - 1; j >= 0; j--) {
    if (c[j] == i) {
      current.push_back((n - j) - (i - 1));
      long long rem = (n - (n - j));
      if (rem > 0) current.push_back(rem);
      break;
    }
  }
  reverse(current.begin(), current.end());
  operations.push_back(current);
  apply(current);
  return 0;
}
void do_one() {
  vector<long long> current;
  for (long long j = 0; j < n; j++) {
    if (c[j] == 1) {
      if (j == 0) return;
      current.push_back(j);
      current.push_back(n - j);
    }
  }
  apply(current);
  operations.push_back(current);
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> c[i];
  do_one();
  bool toggle = 1;
  while (1) {
    if (toggle) {
      if (do_forward()) {
        break;
      }
    } else {
      if (do_backward()) {
        vector<long long> current;
        for (long long w = 0; w < n; w++) current.push_back(1);
        operations.push_back(current);
        apply(current);
        break;
      }
    }
    toggle = !toggle;
  }
  cout << operations.size() << "\n";
  for (vector<long long> o : operations) {
    cout << o.size() << " ";
    for (long long x : o) {
      cout << x << " ";
    }
    cout << "\n";
  }
}
