On Backstab Boulevard, 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 Backstab Boulevard are famously petty, and they cannot stand a lantern with no strong opinions: not the brightest, not the dimmest, just . If the people in houses and both still have their lights on, with , and the lantern of house hangs neither the highest nor the shortest of the three, that is or , then the two of them team up against house and sabotage it. They sneak over at night, unscrew the bulb, and the lantern of house goes dark for good.
A saboteur needs a working lantern to find their way in the dark, so a house whose lantern is already off can never take part in a sabotage again. The residents sabotage as many times as they like, and they are always happy to keep going. Every house is both a potential victim and a potential accomplice.
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
stdin
3
1 2 3
stdout
3 3 0
Note
There are possible ranges :
- , and each contain a single lit lantern. A sabotage needs three lit houses, so nothing happens and .
- and each contain only two lit lanterns. Again no sabotage is possible, so .
- contains all three lanterns, and (). The residents of houses and team up and sabotage house , so its lantern goes dark. Only two lanterns are left on, so no further sabotage is possible, and .