If I have a vector / list of any length, with repeating elements inside, how do I express formally the following transformation $ \overline {v} = (a, b, b, a, a, c, d) \mapsto (3,2,1,1) = \overline {u} $ where the elements of $ \overline {u} $ are "how many times the value $ a- (3) $ has been repeated, how many times it has been repeated the value $ b- (2) $ and so on? .
eg. $(3,6,3,2,2,2,2,4,9,7,77,6)\mapsto(4,2,2,1,1,1,1,1)$
(the order of the elements of $ \overline {u} $ doesn't matter)
You can describe the operation as first taking the multiset of values (which is formally a map from the value domain, here apparently numbers, to the natural numbers associating to each value its multiplicity of occurrence), then taking the multiset of the positive multiplicities, which multiset of positive numbers is then represented as list of those multiplicities, sorted into weakly decreasing order.
In your example the first multiset (of values) is the map sending $1\mapsto0$, $2\mapsto4$, $3\mapsto2$, $4\mapsto1$, $5\mapsto0$, $6\mapsto2$, $7\mapsto1$, $9\mapsto1$, $77\mapsto1$ and $v\mapsto0$ for all remaining values, a multiset that could also be represented as set-with-repetitions $\{\!\!\{2,2,2,2,3,3,4,6,6,7,9,77\}\!\!\}$, then the second multiset (of positive multiplicities) maps $1\mapsto 4$, $2\mapsto2$, $4\mapsto1$ (fortunately the multiplicity $0$ is exempted, as it would have infinite multiplicity, which is not normally allowed in multisets) and this multiset can be represented as $\{\!\!\{4,2,1,2,1,1,1\}\!\!\}=\{\!\!\{1,1,1,1,2,2,4\}\!\!\}$, or as described in weakly decreasing order as the sequence $(4,2,1,1,1,1)$.