This problem is different from Problem B, "Backstab Boulevard". In particular, pay close attention to the second paragraph.
On Spite Street, there are houses numbered from to , and in each house lives exactly one person. Each house has a lantern at height . The heights are distinct integers from to . Initially, all the lanterns are on.
The residents of Spite Street have been feuding over property lines for decades, and the only thing they hate more than each other is a lantern that is smugly 'in between'. Consider a lit house . Let be the closest lit house to its left and be the closest lit house to its right, skipping over any dark houses. If or , the neighbors in and cannot stand it, so they team up to sabotage house . If a house has no lit neighbors on one side, it cannot be ganged up on. They sneak over at night, unscrew the bulb, and the lantern of house goes dark for good. The residents may do this as many times as they like, one house at a time.
One evening, a blown fuse hits the street: all the lanterns outside a range suddenly go off, so only the lanterns of houses to are still on. Because of this crisis, the residents of these houses go mad and sabotage night after night, as many nights as they want. Let be the smallest number of lanterns that can remain on if they choose the order of the sabotages optimally.
The blackout could hit any range of houses, so the residents want to be ready for every possibility. For each from to , count the pairs with such that .
Input
The first line contains an integer , the number of houses.
The second line contains distinct integers , the heights of the lanterns. They form a permutation of the integers from to .
Output
Print integers separated by spaces. The -th integer is the number of pairs with such that .
Example 1
stdin
3
1 2 3
stdout
3 3 0
Example 2
stdin
4
1 3 2 4
stdout
4 3 2 1
Note
In the first example, the only range in which a sabotage is possible is . House is lit, its closest lit neighbors are houses and , and (), so houses and can sabotage house .
In the second example, no sabotage is ever possible.