#include <fstream>
#include <iostream>
using namespace std;
int main()
{
    int n,a[10000],b[10000],vt1,vt2,vtd,vtc;
    int d=0,mx=0;
    ifstream f1("daycondn.inp");
    ofstream f2("daycondn.out");
    f1>>n;
    //cin>>n;
    for (int i = 0; i < n; i++)
    {
        f1>>a[i];
        //cin>>a[i];
    }
    n++; a[n] = -2000000000;
    for (int i = 0; i < n; i++)
    {
        if (a[i] > 0)
        {
            if (d == 0) vt1 = i;
            d++;
        }
        else
        {
            if (d > mx)
            {
                mx = d;
                vtd = vt1; vtc = i-1;
            }
            d = 0;
        }
    }
    f2<<mx<<endl;
    for (int i = vtd; i<= vtc; i++)
    {
        f2<<a[i]<<" ";
    }
    return 0;
}
