#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
long long fexp(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % m;
    b /= 2;
    a = a * a % m;
  }
  return ans;
}
long long inverse(long long a, long long p) { return fexp(a, p - 2, p); }
long long fac[300005];
long long ncr(long long n, long long r, long long p) {
  if (r == 0) return 1;
  return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;
}
void fun(vector<long long> &v, vector<long long> &u) {
  long long a = (long long)u.size();
  vector<vector<long long>> w(a);
  long long k = 0;
  for (long long i = 0; i < a; i++) {
    for (long long j = 0; j < u[i]; j++) {
      w[i].push_back(v[k]);
      k++;
    }
  }
  k = 0;
  for (long long i = a - 1; i >= 0; i--) {
    for (long long j = 0; j < u[i]; j++) {
      v[k] = w[i][j];
      k++;
    }
  }
}
long long solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<vector<long long>> v;
  long long f = 0;
  for (long long i = 0; i < n - 1; i++) {
    vector<long long> u;
    long long x = 0, y = 0;
    for (long long j = 0; j < n; j++) {
      if (a[j] == 1) x = j;
    }
    for (long long j = 0; j < n; j++) {
      if (a[j] == i + 2) y = j;
    }
    if (f == 0 && x > y) {
      if (y > 0) u.push_back(y);
      u.push_back(x - y);
      u.push_back(i + 1);
      long long z = n - (x + i + 1);
      if (z > 0) u.push_back(z);
    } else if (f == 0 && x < y) {
      if (x > 0) u.push_back(x);
      for (long long j = 0; j < i + 1; j++) u.push_back(1);
      u.push_back(y - x - i);
      if (n - y - 1 > 0) u.push_back(n - 1 - y);
      f = 1;
    } else if (f == 1 && x > y) {
      if (y > 0) u.push_back(y);
      u.push_back(x - y - i);
      for (long long j = 0; j < i + 1; j++) u.push_back(1);
      if (n - x - 1 > 0) u.push_back(n - x - 1);
      f = 0;
    } else if (f == 1 && x < y) {
      if (x - i > 0) u.push_back(x - i);
      u.push_back(i + 1);
      u.push_back(y - x);
      if (n - y - 1 > 0) u.push_back(n - 1 - y);
    }
    fun(a, u);
    v.push_back(u);
  }
  if (f == 1) {
    vector<long long> u;
    for (long long i = 0; i < n; i++) u.push_back(1);
    v.push_back(u);
  }
  cout << (long long)v.size() << "\n";
  for (auto vv : v) {
    cout << (long long)vv.size() << " ";
    for (auto vvv : vv) cout << vvv << " ";
    cout << "\n";
  }
  return 0;
}
signed main() {
  auto start = high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
  cerr << "Time taken:" << duration.count() / 1000000.0 << "seconds"
       << "\n";
  return 0;
}
