#abc273c. [abc273_c](K+1)-th Largest Number

[abc273_c](K+1)-th Largest Number

Problem Statement

You are given a sequence A=(A1,A2,ldots,AN)A = (A_1, A_2, \\ldots, A_N) of length NN. For each K=0,1,2,ldots,N1K = 0, 1, 2, \\ldots, N-1, solve the following problem.

Find the number of integers ii between 11 and NN (inclusive) such that:

  • AA contains exactly KK distinct integers greater than AiA_i.

Constraints

  • 1leqNleq2times1051 \\leq N \\leq 2 \\times 10^5
  • 1leqAileq1091 \\leq A_i \\leq 10^9
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN A1A_1 A2A_2 ldots\\ldots ANA_N

Output

Print NN lines. For i=1,2,ldots,Ni = 1, 2, \\ldots, N, the ii-th line should contain the answer for K=i1K = i-1.


Sample Input 1

6
2 7 1 8 2 8

Sample Output 1

2
1
2
1
0
0

For example, we will find the answer for K=2K=2.

  • Regarding A1=2A_1 = 2, AA contains 22 distinct integers greater than A1A_1: 77 and 88.
  • Regarding A2=7A_2 = 7, AA contains 11 distinct integer greater than A2A_2: 88.
  • Regarding A3=1A_3 = 1, AA contains 33 distinct integers greater than A3A_3: 2,72, 7, and 88.
  • Regarding A4=8A_4 = 8, AA contains 00 distinct integers greater than A4A_4 (there is no such integer).
  • Regarding A5=2A_5 = 2, AA contains 22 distinct integers greater than A5A_5: 77 and 88.
  • Regarding A6=8A_6 = 8, AA contains 00 distinct integers greater than A6A_6 (there is no such integer).

Thus, there are two ii's, i=1i = 1 and i=5i = 5, such that AA contains exactly K=2K = 2 distinct integers greater than AiA_i. Therefore, the answer for K=2K = 2 is 22.


Sample Input 2

1
1

Sample Output 2

1

Sample Input 3

10
979861204 57882493 979861204 447672230 644706927 710511029 763027379 710511029 447672230 136397527

Sample Output 3

2
1
2
1
2
1
1
0
0
0