# Chain

# Chain

Given a sequence of **n** integers `a`

, _{1}`a`

, ..., _{2}`a`

. For any element _{n}`a`

(_{k}**k** = **1**, **2**, ..., **n**) we find the first larger than `a`

element, which is placed to the right of _{k}`a`

(if such exists). Denote it by _{k}`a`

. Then do the same with _{k1}`a`

and denote the found element by _{k1}`a`

, and so on until we run out of the given sequence. Thus formed subsequence _{k2}`a`

, _{k1}`a`

, ..., we call chain beginning at index _{k2}**k**.

Write program chain that outputs for any index **k** the length of the corresponding chain that begins at index **k**.

#### Input

On the first line the positive integer **n** (**0** < **n** ≤ **500000**) is written. On the second line, the elements of the given sequence are written `a`

, _{1}`a`

, ..., _{2}`a`

(_{n}**0** < `a`

< _{i}`10`

), separated by spaces.^{6}

#### Output

On a line write the sequence of chain’s lengths, corresponding to the element of the input data. Each two consecutive numbers in the output must be separated by a single space.

11 3 2 4 2 11 2 7 5 8 10 6

2 2 1 1 0 3 2 2 1 0 0