Kruskal Counting Trick