#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, yukuk;
  bool begin = false;
  cin >> n;
  yukuk = n;
  vector<int> a(n), b;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    int pos = -1;
    for (int j = 0; j < n; ++j) {
      if (a[j] == i) {
        pos = j;
        break;
      }
    }
    b.clear();
    b.reserve(n);
    if ((n + i) % 2) {
      if (pos < n - 1) {
        if (!begin) {
          cout << yukuk << '\n';
          begin = true;
        }
        cout << i + 1;
      } else {
        if (i == 1) {
          --yukuk;
          continue;
        }
        if (!begin) {
          cout << yukuk << '\n';
          begin = true;
        }
        cout << i;
      }
      cout << ' ';
      for (int j = 0; j < i - 1; ++j) {
        cout << 1 << ' ';
      }
      cout << pos - i + 2;
      if (pos < n - 1) {
        cout << ' ' << n - pos - 1;
      }
      cout << '\n';
      for (int j = pos + 1; j < n; ++j) {
        b.emplace_back(a[j]);
      }
      for (int j = i - 1; j < pos + 1; ++j) {
        b.emplace_back(a[j]);
      }
      for (int j = 0; j < i - 1; ++j) {
        b.emplace_back(i - 1 - j);
      }
    } else {
      if (pos > 0) {
        if (!begin) {
          cout << yukuk << '\n';
          begin = true;
        }
        cout << i + 1;
      } else {
        if (i == 1) {
          --yukuk;
          continue;
        }
        if (!begin) {
          cout << yukuk << '\n';
          begin = true;
        }
        cout << i;
      }
      cout << ' ';
      if (pos > 0) {
        cout << pos << ' ';
      }
      cout << n - pos - i + 1 << ' ';
      for (int j = 0; j < i - 1; ++j) {
        cout << 1 << ' ';
      }
      cout << '\n';
      for (int j = 0; j < i - 1; ++j) {
        b.emplace_back(j + 1);
      }
      for (int j = pos; j < n - i + 1; ++j) {
        b.emplace_back(a[j]);
      }
      for (int j = 0; j < pos; ++j) {
        b.emplace_back(a[j]);
      }
    }
    a = b;
  }
  if (!begin) {
    cout << yukuk << '\n';
    begin = true;
  }
}
