#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mo = 998244353;
const long long inf = 1e18;
vector<int> p;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  for (auto i = (1); i <= (n); ++i) scanf("%d", &a[i]);
  bool fl = 1;
  for (auto i = (2); i <= (n); ++i)
    if (a[i] > a[i - 1]) {
      fl = 0;
    }
  if (fl) {
    printf("1\n%d", n);
    for (auto i = (1); i <= (n); ++i) printf(" 1");
    printf("\n");
    return 0;
  }
  printf("%d\n", n / 2 * 2);
  for (auto i = (1); i <= (n / 2 * 2); ++i) {
    p.clear();
    int t = 0;
    for (auto j = (1); j <= (n); ++j)
      if (j > 1 && ((a[j] < a[j - 1]) ^ (i & 1))) {
        p.push_back(t);
        for (auto k = (1); k <= (t / 2); ++k) swap(a[j - t - 1 + k], a[j - k]);
        t = 1;
      } else
        ++t;
    p.push_back(t);
    for (auto k = (1); k <= (t / 2); ++k) swap(a[n - t + k], a[n - k + 1]);
    for (auto k = (1); k <= (n / 2); ++k) swap(a[k], a[n - k + 1]);
    printf("%d", (int)p.size());
    for (auto& j : p) printf(" %d", j);
    printf("\n");
  }
}
