#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("daycondn"".inp","r",stdin);
	freopen("daycondn"".out","w",stdout);
	int a[10000],b[10000],max=0,max1=0,n,d=0,m=0,vitri;
	cin>>n;
	for (int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for (int i=0;i<n;i++)
	{
		if (a[i]>0)
		{
			d++;
			if (d>max)
			{
			    vitri=i;
			}
		}
		if (a[i]<0)
		{
			b[m++]=d;
			if (d>max)
			{
				max=d;
			}
			d=0;
		}
	}
	for (int i=0;i<m+1;i++)
	{
		if (b[i]==max)
		max1++;
	}
	cout<<max1<<endl;
	for (int i=vitri+1-max;i<vitri+1;i++)
	{
		cout<<a[i]<<" ";
	}
}
