counting sort + MSD fix