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?y*h[x^a]:y*y-y;(s=c+s/2)