#include<stdio.h> int main() { int n,i,j=1,m,a[101]={0},t=0,q=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&m); if(m<0)t++; if(t>=3)t=1,a[j++]=q,q=1; else q++; } a[j]=q;printf("%d\n",j); for(i=1;i<=j;i++) printf("%d ",a[i]); return 0; }
http://codeforces.com/contest/250/problem/A