Counting sort in C