a[20],i,j,s;main(n){for(;~scanf("%d",a+i);s+=!!i*a[i++]);for(n=sqrt(s);++j<2*n;)s-=2*n-j