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