#P1954E. Chain Reaction

    ID: 9234 Type: RemoteJudge 3000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 8 Uploaded By: Tags>binary searchdata structuresdsugreedyimplementationmathnumber theory*2200

Chain Reaction

No submission language available for this problem.

Description

There are nn monsters standing in a row. The ii-th monster has aia_i health points.

Every second, you can choose one alive monster and launch a chain lightning at it. The lightning deals kk damage to it, and also spreads to the left (towards decreasing ii) and to the right (towards increasing ii) to alive monsters, dealing kk damage to each. When the lightning reaches a dead monster or the beginning/end of the row, it stops. A monster is considered alive if its health points are strictly greater than 00.

For example, consider the following scenario: there are three monsters with health equal to [5,2,7][5, 2, 7], and k=3k = 3. You can kill them all in 44 seconds:

  • launch a chain lightning at the 33-rd monster, then their health values are [2,1,4][2, -1, 4];
  • launch a chain lightning at the 11-st monster, then their health values are [1,1,4][-1, -1, 4];
  • launch a chain lightning at the 33-rd monster, then their health values are [1,1,1][-1, -1, 1];
  • launch a chain lightning at the 33-th monster, then their health values are [1,1,2][-1, -1, -2].

For each kk from 11 to max(a1,a2,,an)\max(a_1, a_2, \dots, a_n), calculate the minimum number of seconds it takes to kill all the monsters.

The first line contains a single integer nn (1n1051 \le n \le 10^5) — the number of monsters.

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1051 \le a_i \le 10^5) — the health points of the ii-th monster.

For each kk from 11 to max(a1,a2,,an)\max(a_1, a_2, \dots, a_n), output the minimum number of seconds it takes to kill all the monsters.

Input

The first line contains a single integer nn (1n1051 \le n \le 10^5) — the number of monsters.

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1051 \le a_i \le 10^5) — the health points of the ii-th monster.

Output

For each kk from 11 to max(a1,a2,,an)\max(a_1, a_2, \dots, a_n), output the minimum number of seconds it takes to kill all the monsters.

Sample Input 1

3
5 2 7

Sample Output 1

10 6 4 3 2 2 1

Sample Input 2

4
7 7 7 7

Sample Output 2

7 4 3 2 2 2 1

Sample Input 3

10
1 9 7 6 2 4 7 8 1 3

Sample Output 3

17 9 5 4 3 3 3 2 1