#C12019. Team Ranking Based on Tasks Solved

    ID: 41400 Type: Default 1000ms 256MiB

Team Ranking Based on Tasks Solved

Team Ranking Based on Tasks Solved

In a coding competition, teams are ranked based on the number of tasks they have solved. Teams with higher scores rank higher. In case of ties, the tied teams share the same rank, and the next rank is determined by the actual position in the sorted order.

For example, if the tasks solved by teams are [50, 40, 40, 30, 20], then the ranks are [1, 2, 2, 4, 5] because the second and third teams (with 40 tasks each) share the same rank.

Your task is to write a program that accepts the number of teams followed by the list of tasks solved by each team and outputs the rank for each team. The input is provided via stdin and the output should be printed to stdout.

inputFormat

The input consists of two lines. The first line contains an integer (n) representing the number of teams. The second line contains (n) space-separated integers, where each integer indicates the number of tasks solved by the corresponding team.

outputFormat

Print a single line containing (n) space-separated integers representing the rank of each team in the order of the input. Teams with the same task count should have the same rank; the ranking is based on sorted order (highest to lowest).## sample

5
50 40 40 30 20
1 2 2 4 5