#K48412. Student Score Ranking

    ID: 28415 Type: Default 1000ms 256MiB

Student Score Ranking

Student Score Ranking

In this problem, you are given a list of integers representing the scores of students in a class. Your task is to determine the rank for each student based on their score. The ranking is done as follows:

  1. The highest score is given a rank of 1.
  2. If two or more students have the same score, they share the same rank.
  3. The next distinct score receives a rank equal to the number of students with higher scores plus one.

Formally, if the scores sorted in descending order are (s_1, s_2, \dots, s_n), then for any score (s_i), its rank (r_i) is defined by (r_i = 1 + #{j : s_j > s_i}).

You need to implement a program that reads the input from standard input and outputs the result to standard output.

inputFormat

The first line contains an integer (n) ((1 \le n \le 10^5)), representing the number of students. The second line contains (n) space-separated integers, each representing a student's score.

outputFormat

Print a single line with (n) space-separated integers, where the (i)-th integer represents the rank of the (i)-th student from the input.## sample

1
100
1

</p>