Fastest ever (nothing can be faster)
a = [1, 2, 3, 3, 3, 1, 2, 4, 5, 5, 5, 5] count = [0] * 10 for e in a: count[e] = count[e] + 1 for i, c in enumerate(count): if c > 0: print(c, " of ", i)