Task
Basically you have an array of random integers e.g.
I() = [1, 4, 3, 2, 5, 3, 2, 1]
and you have to create another array of the same length with the numbers 1 to the size of the array in place of the smallest to largest numbers respectively, e.g.
O() = [1, 7, 5, 3, 8, 6, 4, 2]
For duplicates, the first occurrence is taken as the smaller of the indices.
Test Cases:
Input: I() = [1, 5, 3, 4, 5, 3, 2, 4]
Output: O() = [1, 7, 3, 5, 8, 4, 2, 6]
Input: I() = [1, 5, 3, 2, 5, 3, 2, 4, 6, 6, 5]
Output: O() = [1, 7, 4, 2, 8, 5, 3, 6, 10, 11, 9]
Rules
It should work with array of any finite length
All integers are positive(greater than 0)
This is code-golf, so the submission with the least amount of bytes wins!