ll@N,@K,@A[N],a=0,c=0,s;rrep(d,30){a*=2;maph;rep[A](x,N)++h[x>>d];s=0;for(auto&[x,y]:h)s+=a?h.count(x^a)?y*h[x^a]:0:y*y-y;(s=c+s/2)