counting sort and find duplicate