Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/saralash-saralangandagi-orni

Position after sorting

Easy 1000 ms 128 MB 33%
Share

$n$ integers are given. They are sorted in increasing order, and equal numbers keep their order in the array. For each $a_{i}$, determine which place (places are numbered from $1$) it gets in the sorted array.

Array cells and arrows to their places in the sorted array

Input

The first line contains a positive integer $n$. The second line contains $n$ integers $a_{i}$.

Output

$n$ numbers separated by spaces — the places of $a_{1}, a_{2}, \ldots, a_{n}$.

Note

$1 \le n \le 2 \cdot 10^{5}$
$-10^{9} \le a_{i} \le 10^{9}$

Examples

Input #1
5
40 10 30 10 20
Output #1
5 1 4 2 3
Input #2
1
5
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.