i,j,s,a[1<<17],b[1<<17];main(n){for(gets(&n);~scanf("%d",&n);b[j]++,a[j]=n,i+=i==j)for(j=-1;++j