from collections import Counter a = [12, 34, 542, 63653, 635, 635] print(Counter(a))