i,j,k,s,a[1<<17];main(n){for(gets(&n);~scanf("%d",&n);a[i++]=n,s+=k-1?!!k:-1)for(k=2,j=0;j