675. Money Trading

0

Easy

Om has been employed by 'Money Traders', a money trading organization, for several years. His manager has assigned him a task: given an array/list of stock prices for N days, determine the stock's span for each day. The stock's span for a particular day is defined as the maximum number of consecutive days (starting from that day and going backwards) for which the stock price was lower than the price on that day.

Input Format

The first line contains the size of the array.
The second line contains N elements of the array.

Output Format

Print the stock's span for each day.

Example

Input

7 100 80 60 70 60 75 85

Output

1 1 1 2 1 4 6

Constraints

0 <= N <= 10^7
1 <= X <= 10^9
Where X represents the price of a stock for a single day.
Loading...

View Submissions

Console