ll n,d,a[2d5],b[2d5]; { rd(n,d,a(n)); b[0..n-1]=a[0..]; sortA(n,b); rep(i,n)wt(bsearch_max[ll,j,0,n](a[i]-b[j-1]>=d)); }