vector<int> ans[maxn]; int c1; intmain(){ cin >> n; a[0] = 0; for (int i = 1; i <= n; ++i) cin >> a[i], A[a[i]] = i; while (1) { int l = -1, r, k; for (int i = 1; i < n; ++i) if (A[a[i] - 1] > i) l = i, r = A[a[i] - 1]; for (int i = l; i < r; ++i) if (a[i] > a[i + 1]) k = i; if (l == -1) break; ++c1; int s1 = l - 1, s2 = k - l + 1, s3 = r - k, s4 = n - r; for (int i = 1; i <= n; ++i) b[i] = a[i]; for (int i = 1; i <= s4; ++i) a[i] = b[r + i]; for (int i = 1; i <= s3; ++i) a[s4 + i] = b[k + i]; for (int i = 1; i <= s2; ++i) a[s4 + s3 + i] = b[l + i - 1]; for (int i = 1; i <= s1; ++i) a[s4 + s3 + s2 + i] = b[i]; for (int i = 1; i <= n; ++i) A[a[i]] = i; ans[c1].pb(2 + (s1 > 0) + (s4 > 0)); ans[c1].pb(s1); ans[c1].pb(s2); ans[c1].pb(s3); ans[c1].pb(s4); } cout << c1 << endl; for (int i = 1; i <= c1; ++i, puts("")) for (auto u : ans[i]) if (u) cout << u << " "; return0; }