void sort(unsigned *a, int n){
#define N 100000000
#define D 128
#define D1 127
#define cal(w,w2,tw,op) \
p=w2-1;\
for(i=0;i<D;++i)rs[i]=p,p+=tw[i];\
for(i=0;i<N;i+=4){\
p=w+i;\
*++rs[p[0]op]=p[0],\
*++rs[p[1]op]=p[1],\
*++rs[p[2]op]=p[2],\
*++rs[p[3]op]=p[3];
}
unsigned b[N],*rs[D],t0[D],t1[D],t2[D],t3[D],t4[D];
unsigned*p,i,x;
for(i=0;i<N;){
#define A x=a[i],++t0[x&D1],++t1[x>>7&D1],++t2[x>>14&D1],++t3[x>>21&D1],++t4[x>>28&D1],++i;
A A A A
#undef A
}
cal(a,b,t0,&D1);
cal(b,a,t1,>>7&D1);
cal(a,b,t2,>>14&D1);
cal(b,a,t3,>>21&D1);
}