LIS of Pairs
Very hard
Execution time limit is 1 second
Runtime memory usage limit is 256 megabytes
You have pairs of integers, where holds for all .
Let's define as the length of the longest strictly increasing subsequence of the sequence .
It's clear that .
For every from to , find the number of ordered pairs with , for which .
Note that a sequence labeled with is an increasing subsequence of only if:
Input
The first line of the input contains integers ().
The -th of the following lines contains integers ().
Output
Print integers. The -th of them should be equal to the number of ordered pairs with , for which .
Examples
Input #1
Answer #1
Input #2
Answer #2
Note
In the first sample:
.
.
.
.
In the second sample, all numbers are equal, so we wouldn't be able to choose any increasing subsequence of length at least .
Submissions 3