#include <bits/stdc++.h>
using namespace std;
const long double epsylon = 1e-9;
const std::string PROGRAM_NAME = "ivo";
vector<int> do_operation(const vector<int>& a, const vector<int>& op) {
  vector<vector<int> > help;
  int cur = 0;
  for (int i = 0; i < (int)op.size(); ++i) {
    vector<int> temp(op[i]);
    for (int j = 0; j < op[i]; ++j) {
      temp[j] = a[cur++];
    }
    help.push_back(temp);
  }
  vector<int> res;
  for (int i = (int)help.size() - 1; i >= 0; --i) {
    for (int j = 0; j < (int)help[i].size(); ++j) {
      res.push_back(help[i][j]);
    }
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)a.size(); ++i) {
    cin >> a[i];
    a[i]--;
  }
  vector<vector<int> > operations;
  for (int i = 0; i < n; ++i) {
    if (a[i] == 0) {
      if (i != 0) {
        vector<int> temp;
        temp.push_back(i);
        temp.push_back(n - i);
        a = do_operation(a, temp);
        operations.push_back(temp);
      }
    }
  }
  for (int it = 0; it < n; ++it) {
    if (a[0] == 0) {
      int len = 1;
      while (len < n && a[len] == len) {
        len++;
      }
      if (len == n) {
        break;
      }
      vector<int> temp;
      temp.push_back(len);
      for (int j = len + 1; j < n; ++j) {
        if (a[j] == len) {
          temp.push_back(j - len + 1);
          if (n - j - 1 > 0) {
            temp.push_back(n - j - 1);
          }
          break;
        }
      }
      a = do_operation(a, temp);
      operations.push_back(temp);
    } else {
      int len = a[n - 1] + 1;
      vector<int> temp;
      int total = len;
      temp.push_back(len);
      int to_search = n - 1;
      if (a[n - len - 1] == len) {
        temp.push_back(1);
        if (len == n - 1) {
          reverse(temp.begin(), temp.end());
          a = do_operation(a, temp);
          operations.push_back(temp);
          continue;
        } else {
          to_search = len + 1;
        }
        total++;
      }
      for (int j = n - len - 1; j >= 0; --j) {
        if (a[j] == to_search) {
          temp.push_back(n - j - total);
          if (j > 0) {
            temp.push_back(j);
          }
          break;
        }
      }
      reverse(temp.begin(), temp.end());
      a = do_operation(a, temp);
      operations.push_back(temp);
    }
  }
  cout << operations.size() << endl;
  for (int i = 0; i < (int)operations.size(); ++i) {
    printf("%d", (int)operations[i].size());
    for (int j = 0; j < (int)operations[i].size(); ++j) {
      printf(" %d", operations[i][j]);
    }
    cout << endl;
  }
  return 0;
}
