#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  vector<vector<long long int>> ans;
  while (1) {
    vector<long long int> sans;
    for (long long int i = 0; i < n; i++) {
      if (arr[i] == i + 1) continue;
      if (i != 0) sans.push_back(i);
      for (long long int j = i + 1; j < n; j++) {
        if (arr[j] == arr[j - 1] + 1) continue;
        sans.push_back(j - i);
        for (long long int k = j; k < n; k++) {
          if (arr[k] != arr[i] - 1) continue;
          sans.push_back(k - j + 1);
          if (k < n - 1) sans.push_back(n - 1 - k);
          break;
        }
        break;
      }
      break;
    }
    if (sans.size() == 0) {
      break;
    }
    ans.push_back(sans);
    long long int temp[n];
    long long int sm = 0;
    for (long long int i = 0; i < sans.size(); i++) {
      long long int tmp = sans[i];
      for (long long int j = 0; j < tmp; j++) {
        temp[n - sm - tmp + j] = arr[sm + j];
      }
      sm += tmp;
    }
    for (long long int i = 0; i < n; i++) {
      arr[i] = temp[i];
    }
  }
  cout << ans.size() << "\n";
  for (long long int i = 0; i < ans.size(); i++) {
    cout << ans[i].size() << " ";
    for (long long int j = 0; j < ans[i].size(); j++) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
