lengths = Counter(len(v) for v in list(userIdDict.values()))
total = 0
accumulated = {}
for length in range(max(lengths), -1, -1):
    count = lengths.get(length, 0)
total += count
accumulated[length] = total
How to count size of lists with a dict?