The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

binary search

data structures

*1500

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. Queue

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThere are *n* walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the *n*-th walrus stands at the beginning of the queue. The *i*-th walrus has the age equal to *a*_{i}.

The *i*-th walrus becomes displeased if there's a younger walrus standing in front of him, that is, if exists such *j* (*i* < *j*), that *a*_{i} > *a*_{j}. The displeasure of the *i*-th walrus is equal to the number of walruses between him and the furthest walrus ahead of him, which is younger than the *i*-th one. That is, the further that young walrus stands from him, the stronger the displeasure is.

The airport manager asked you to count for each of *n* walruses in the queue his displeasure.

Input

The first line contains an integer *n* (2 ≤ *n* ≤ 10^{5}) — the number of walruses in the queue. The second line contains integers *a*_{i} (1 ≤ *a*_{i} ≤ 10^{9}).

Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other one.

Output

Print *n* numbers: if the *i*-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the *i*-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus.

Examples

Input

6

10 8 5 3 50 45

Output

2 1 0 -1 0 -1

Input

7

10 4 6 3 2 8 15

Output

4 2 1 0 -1 -1 -1

Input

5

10 3 1 10 11

Output

1 0 -1 -1 -1

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/03/2023 10:08:35 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|