#include <bits/stdc++.h>
using namespace std;
int a[200010], t[200010], b[200010], out[100][100], ans[100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    t[i] = a[i];
  }
  if (n & 1)
    sort(t + 1, t + n + 1);
  else
    sort(t + 1, t + n + 1, greater<int>());
  int flag = 0;
  int tot = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      ans[0] = 0;
      if (a[j] == t[i]) {
        if (flag == 0) {
          if (j > 1) ans[++ans[0]] = j - 1;
          ans[++ans[0]] = n - j + 1 - (i - 1);
          if (i > 1) {
            for (int k = n - i + 2; k <= n; k++) {
              ans[++ans[0]] = 1;
            }
          }
        } else {
          if (i > 1) {
            for (int k = 1; k < i; k++) {
              ans[++ans[0]] = 1;
            }
          }
          ans[++ans[0]] = j - (i - 1);
          if (j < n) ans[++ans[0]] = n - j;
        }
        flag ^= 1;
        break;
      }
    }
    if (ans[0] <= 1) continue;
    tot++;
    int sum = 0;
    out[tot][0] = ans[0];
    for (int i = 1; i <= ans[0]; i++) {
      out[tot][i] = ans[i];
      sum += ans[i];
      for (int j = 1; j <= ans[i]; j++) {
        b[n - sum + j] = a[sum - ans[i] + j];
      }
    }
    for (int i = 1; i <= n; i++) {
      a[i] = b[i];
    }
  }
  printf("%d\n", tot);
  for (int i = 1; i <= tot; i++) {
    for (int j = 0; j <= out[i][0]; j++) {
      printf("%d ", out[i][j]);
    }
    puts("");
  }
}
