Given $N$ coordinates $X_1, \dots, X_N$ on a line, replace each $X_i$ with $X'_i$, the number of distinct coordinates $X_j$ strictly smaller than $X_i$. Print $X'_1, \dots, X'_N$.
Input
First line $N$ ($1 \le N \le 10^6$); second line the $N$ coordinates ($-10^9 \le X_i \le 10^9$).
Output
Print $X'_1, \dots, X'_N$ space-separated on one line.
Example 1
Input
5 2 4 -10 4 -9
Output
2 3 0 3 1
Example 2
Input
6 1000 999 1000 999 1000 999
Output
1 0 1 0 1 0
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.