#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  scanf("%d", &n);
  int a[52];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
  }
  vector<vector<int> > ans;
  for (int i = 0; i < n; i++) {
    if (i == n - 1 && n % 2 == 1) break;
    for (int j = 0; j < n; j++) {
      if (a[j] == i) {
        if (i % 2 == 0) {
          vector<int> tmp;
          int tot = n;
          for (int k = 0; k < i; k++) tmp.push_back(1);
          if (j - i + 1) tmp.push_back(j - i + 1);
          tot -= j - i + 1;
          tot -= i;
          if (tot) tmp.push_back(tot);
          ans.push_back(tmp);
        } else {
          vector<int> tmp;
          int tot = n;
          for (int k = 0; k < i; k++) tmp.push_back(1);
          tot -= i;
          tot -= j;
          if (tot) tmp.push_back(tot);
          if (j) tmp.push_back(j);
          reverse(tmp.begin(), tmp.end());
          ans.push_back(tmp);
        }
        break;
      }
    }
    if (ans.back().size() == 1) {
      ans.pop_back();
      continue;
    }
    vector<vector<int> > v;
    int now = 0;
    for (auto it : ans.back()) {
      vector<int> tt;
      for (int i = 0; i < it; i++) {
        tt.push_back(a[now]);
        now++;
      }
      v.push_back(tt);
    }
    reverse(v.begin(), v.end());
    now = 0;
    for (auto it : v) {
      for (auto it2 : it) {
        a[now++] = it2;
      }
    }
  }
  printf("%d\n", ans.size());
  for (auto it : ans) {
    printf("%d ", it.size());
    for (auto it2 : it) {
      printf("%d ", it2);
    }
    printf("\n");
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
