#C12957. Frequency Replacement in a List
Frequency Replacement in a List
Frequency Replacement in a List
Given a list of integers, replace each element of the list with its frequency of occurrence in the original list.
In other words, for each element x in the list, determine how many times x appears and replace that element with that count.
The mathematical formulation of the operation for an element x is given by:
$$ f(x) = \#\{ i \mid a_i = x \} $$
where \(a_i\) refers to the i-th element of the list.
You are required to read the input from standard input and print the output to standard output. The list is given by first an integer n (the number of elements), followed by n integers. The output should be the transformed list, where numbers are separated by a single space.
inputFormat
The first line contains an integer n representing the number of elements in the list.
The second line contains n integers separated by spaces.
outputFormat
Output a single line with n integers where each integer is replaced by its frequency in the original list, separated by a single space.
## sample5
1 2 3 4 5
1 1 1 1 1