Generalized util.TopN to use Count interface