I have a list of repeating values from 0 to 1500. The total length of the list is 80.000. Each value repeats differently. I would like to create a list with the number of times each value is found in a list.

I found THIS solution which separates same values into branches. I could use list length to get the number of repeats, but this solution tests every number for equality and it’s not very efficient. Is there a better way?

So the list looks something like:

0

1

1

2

2

2

2

2

3

3

…

and I would like to get:

1

2

5

2

…