unsigned long long A[1<<26];
void sort(unsigned *a, int n) {
for (int i=0; i<n; ++i) asm("bts %1, %0": "=m"(A[1<<25]): "r"(a[i]));
for (int i=0; i<1<<25; ++i) {
unsigned long long t = &(A[1<<25])[i];
while (t) {
*a++ = i * 64u + __builtin_ctzll(t); t &= t-1; }}
for (int i=-1<<25; i<0; ++i) {
unsigned long long t = &(A[1<<25])[i];
while (t) {
*a++ = i * 64u + __builtin_ctzll(t); t &= t-1; }}
}