#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
cin >> arr[i];
int maxLen = 1, start = 0, end = 0;
int batDau[n], ketThuc[n];
int cnt = 0;
for (int i = 1; i < n; i++) {
if (arr[i] > arr[i - 1]) {
end = i;
if (end - start + 1 > maxLen) {
maxLen = end - start + 1;
cnt = 0;
batDau[cnt] = start;
ketThuc[cnt] = end;
cnt++;
} else if (end - start + 1 == maxLen) {
batDau[cnt] = start;
ketThuc[cnt] = end;
cnt++;
}
} else {
start = i;
end = i;
}
}
cout << maxLen << '\n';
for (int i = 0; i < cnt; i++) {
for (int j = batDau[i]; j <= ketThuc[i]; j++) {
cout << arr[j] << " ";
}
cout << '\n';
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBpbnQgbjsKICAgIGNpbiA+PiBuOwogICAgaW50IGFycltuXTsKCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykKICAgICAgICBjaW4gPj4gYXJyW2ldOwoKICAgIGludCBtYXhMZW4gPSAxLCBzdGFydCA9IDAsIGVuZCA9IDA7CiAgICBpbnQgYmF0RGF1W25dLCBrZXRUaHVjW25dOwogICAgaW50IGNudCA9IDA7CgogICAgZm9yIChpbnQgaSA9IDE7IGkgPCBuOyBpKyspIHsKICAgICAgICBpZiAoYXJyW2ldID4gYXJyW2kgLSAxXSkgewogICAgICAgICAgICBlbmQgPSBpOwogICAgICAgICAgICBpZiAoZW5kIC0gc3RhcnQgKyAxID4gbWF4TGVuKSB7CiAgICAgICAgICAgICAgICBtYXhMZW4gPSBlbmQgLSBzdGFydCArIDE7CiAgICAgICAgICAgICAgICBjbnQgPSAwOwogICAgICAgICAgICAgICAgYmF0RGF1W2NudF0gPSBzdGFydDsKICAgICAgICAgICAgICAgIGtldFRodWNbY250XSA9IGVuZDsKICAgICAgICAgICAgICAgIGNudCsrOwogICAgICAgICAgICB9IGVsc2UgaWYgKGVuZCAtIHN0YXJ0ICsgMSA9PSBtYXhMZW4pIHsKICAgICAgICAgICAgICAgIGJhdERhdVtjbnRdID0gc3RhcnQ7CiAgICAgICAgICAgICAgICBrZXRUaHVjW2NudF0gPSBlbmQ7CiAgICAgICAgICAgICAgICBjbnQrKzsKICAgICAgICAgICAgfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHN0YXJ0ID0gaTsKICAgICAgICAgICAgZW5kID0gaTsKICAgICAgICB9CiAgICB9CgogICAgY291dCA8PCBtYXhMZW4gPDwgJ1xuJzsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY250OyBpKyspIHsKICAgICAgICBmb3IgKGludCBqID0gYmF0RGF1W2ldOyBqIDw9IGtldFRodWNbaV07IGorKykgewogICAgICAgICAgICBjb3V0IDw8IGFycltqXSA8PCAiICI7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgJ1xuJzsKICAgIH0KCiAgICByZXR1cm4gMDsKfQo=