inlineintlen(int l, int r){ if (l > r) return0; return r - l + 1; }
int n, m, A[maxn];
voidoperate(vector<int> &cur){ vector<vector<int>> a; int j = 1; for (auto x : cur) { a.push_back(vector<int>()); for (int i = j;i < j + x; ++i) a.back().push_back(A[i]); j = j + x; } reverse(a.begin(), a.end()); int tot = 0; for (auto v : a) for (auto x : v) A[++tot] = x; }
boolsorted(){ for (int i = 1;i <= n; ++i) if (A[i] != i) returnfalse; returntrue; }
intmain(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1;i <= n; ++i) { cin >> A[i]; } vector<vector<int>> ans; int k; int l, r; for (int i = 1;i <= n; ++i) { if (sorted()) break; k = (i+1)/2; if (i % 2 == 0) k = n - i/2 + 1; l = 1 + i/2; r = n - (i+1)/2 + 1; int pos = 0; for (int j = 1;j <= n; ++j) { if (A[j] == k) { pos = j; break; } } ans.push_back(vector<int>()); for (int j = 1;j <= l-1; ++j) ans.back().push_back(1); if (len(l, pos-1) > 0) ans.back().push_back(len(l, pos-1)); if (len(pos, r) > 0) ans.back().push_back(len(pos, r)); for (int j = r+1;j <= n; ++j) ans.back().push_back(1); if (sz(ans.back()) == 1) { ans.pop_back(); continue; } operate(ans.back()); } cout << sz(ans) << endl; for (auto v : ans) { cout << sz(v) << " "; for (auto x : v) cout << x << " "; cout << endl; } return0; }