Couldn't you just do that with radix sort or am I missing something?
Or more efficient, dynamically construct an implicit trie/heap type thing, where each leaf is the count of times that int appears (and the int itself is encoded in the location)
That feels really, really handwavy but promising?
You're right, that does sound impossible. :O