#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  int ct = 0, l = 1, r = n;
  vector<vector<int> > ans;
  if (n % 2) {
    int cnt = 0;
    while (cnt != n) {
      vector<int> xx;
      cnt++;
      if (!ct) {
        int k = 0;
        for (int i = 1; i <= n; i++) {
          if (a[i] == l) break;
          k++;
        }
        k++;
        k += l - 1;
        if (k == 1) {
          ct ^= 1;
          continue;
        }
        xx.push_back(k);
        vector<vector<int> > tmp;
        int i;
        for (i = 1; i <= n; i++) {
          vector<int> temp;
          if (a[i] == l) break;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        vector<int> tt;
        for (; i <= n - (l - 1); i++) {
          tt.push_back(a[i]);
          if (i == n - l + 1) {
            tmp.push_back(tt);
          }
        }
        for (; i <= n; i++) {
          vector<int> temp;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        reverse(tmp.begin(), tmp.end());
        int ind = 1;
        for (auto it : tmp) {
          for (auto itr : it) {
            a[ind] = itr;
            ind++;
          }
        }
        reverse(tmp.begin(), tmp.end());
        for (auto it : tmp) xx.push_back((int)it.size());
        l++;
        ans.push_back(xx);
      } else {
        vector<int> xx;
        int k = 0;
        for (int i = 1; i <= n; i++) {
          if (a[i] == r) break;
          k++;
        }
        k++;
        k += (n - r);
        if (k == 1) {
          ct ^= 1;
          continue;
        }
        xx.push_back(k);
        vector<vector<int> > tmp;
        int i;
        for (i = 1; i <= n; i++) {
          vector<int> temp;
          if (a[i] == r) break;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        vector<int> tt;
        for (; i <= r; i++) {
          tt.push_back(a[i]);
          if (i == r) tmp.push_back(tt);
        }
        for (; i <= n; i++) {
          vector<int> temp;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        reverse(tmp.begin(), tmp.end());
        int ind = 1;
        for (auto it : tmp) {
          for (auto itr : it) {
            a[ind] = itr;
            ind++;
          }
        }
        reverse(tmp.begin(), tmp.end());
        for (auto it : tmp) xx.push_back((int)it.size());
        --r;
        ans.push_back(xx);
      }
      ct ^= 1;
    }
  } else {
    int cnt = 0;
    ct = 1;
    while (cnt != n) {
      vector<int> xx;
      cnt++;
      if (!ct) {
        int k = 0;
        for (int i = 1; i <= n; i++) {
          if (a[i] == l) break;
          k++;
        }
        k++;
        k += l - 1;
        if (k == 1) {
          ct ^= 1;
          continue;
        }
        xx.push_back(k);
        vector<vector<int> > tmp;
        int i;
        for (i = 1; i <= n; i++) {
          vector<int> temp;
          if (a[i] == l) break;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        vector<int> tt;
        for (; i <= n - (l - 1); i++) {
          tt.push_back(a[i]);
          if (i == n - l + 1) {
            tmp.push_back(tt);
          }
        }
        for (; i <= n; i++) {
          vector<int> temp;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        reverse(tmp.begin(), tmp.end());
        int ind = 1;
        for (auto it : tmp) {
          for (auto itr : it) {
            a[ind] = itr;
            ind++;
          }
        }
        reverse(tmp.begin(), tmp.end());
        for (auto it : tmp) xx.push_back((int)it.size());
        l++;
        ans.push_back(xx);
      } else {
        vector<int> xx;
        int k = 0;
        for (int i = 1; i <= n; i++) {
          if (a[i] == r) break;
          k++;
        }
        k++;
        k += (n - r);
        if (k == 1) {
          ct ^= 1;
          continue;
        }
        xx.push_back(k);
        vector<vector<int> > tmp;
        int i;
        for (i = 1; i <= n; i++) {
          vector<int> temp;
          if (a[i] == r) break;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        vector<int> tt;
        for (; i <= r; i++) {
          tt.push_back(a[i]);
          if (i == r) tmp.push_back(tt);
        }
        for (; i <= n; i++) {
          vector<int> temp;
          temp.push_back(a[i]);
          tmp.push_back(temp);
        }
        reverse(tmp.begin(), tmp.end());
        int ind = 1;
        for (auto it : tmp) {
          for (auto itr : it) {
            a[ind] = itr;
            ind++;
          }
        }
        reverse(tmp.begin(), tmp.end());
        for (auto it : tmp) xx.push_back((int)it.size());
        --r;
        ans.push_back(xx);
      }
      ct ^= 1;
    }
  }
  cout << ans.size() << endl;
  for (auto it : ans) {
    for (auto itr : it) cout << itr << " ";
    cout << endl;
  }
  return 0;
}
