Codeforces Beta Round 75 (Div. 2 Only)
D
Queue
Codeforces
未评级
原题
← CE →
翻译中…

There 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.

翻译中…

样例

Input #1
6
10 8 5 3 50 45
Output #1
2 1 0 -1 0 -1
InputCopy OutputCopy
Input #2
7
10 4 6 3 2 8 15
Output #2
4 2 1 0 -1 -1 -1
InputCopy OutputCopy
Input #3
5
10 3 1 10 11
Output #3
1 0 -1 -1 -1
InputCopy OutputCopy
题目信息
题号
92D
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。