implement counting sort