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