Codeforces Round 406 (Div. 1) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

data structures

divide and conquer

*2400

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Till I Collapse

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputRick and Morty want to find MR. PBH and they can't do it alone. So they need of Mr. Meeseeks. They Have generated *n* Mr. Meeseeks, standing in a line numbered from 1 to *n*. Each of them has his own color. *i*-th Mr. Meeseeks' color is *a*_{i}.

Rick and Morty are gathering their army and they want to divide Mr. Meeseeks into some squads. They don't want their squads to be too colorful, so each squad should have Mr. Meeseeks of at most *k* different colors. Also each squad should be a continuous subarray of Mr. Meeseeks in the line. Meaning that for each 1 ≤ *i* ≤ *e* ≤ *j* ≤ *n*, if Mr. Meeseeks number *i* and Mr. Meeseeks number *j* are in the same squad then Mr. Meeseeks number *e* should be in that same squad.

Also, each squad needs its own presidio, and building a presidio needs money, so they want the total number of squads to be minimized.

Rick and Morty haven't finalized the exact value of *k*, so in order to choose it, for each *k* between 1 and *n* (inclusive) need to know the minimum number of presidios needed.

Input

The first line of input contains a single integer *n* (1 ≤ *n* ≤ 10^{5}) — number of Mr. Meeseeks.

The second line contains *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n} separated by spaces (1 ≤ *a*_{i} ≤ *n*) — colors of Mr. Meeseeks in order they standing in a line.

Output

In the first and only line of input print *n* integers separated by spaces. *i*-th integer should be the minimum number of presidios needed if the value of *k* is *i*.

Examples

Input

5

1 3 4 3 3

Output

4 2 1 1 1

Input

8

1 5 7 8 1 7 6 1

Output

8 4 3 2 1 1 1 1

Note

For the first sample testcase, some optimal ways of dividing army into squads for each *k* are:

- [1], [3], [4], [3, 3]
- [1], [3, 4, 3, 3]
- [1, 3, 4, 3, 3]
- [1, 3, 4, 3, 3]
- [1, 3, 4, 3, 3]

For the second testcase, some optimal ways of dividing army into squads for each *k* are:

- [1], [5], [7], [8], [1], [7], [6], [1]
- [1, 5], [7, 8], [1, 7], [6, 1]
- [1, 5, 7], [8], [1, 7, 6, 1]
- [1, 5, 7, 8], [1, 7, 6, 1]
- [1, 5, 7, 8, 1, 7, 6, 1]
- [1, 5, 7, 8, 1, 7, 6, 1]
- [1, 5, 7, 8, 1, 7, 6, 1]
- [1, 5, 7, 8, 1, 7, 6, 1]

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/15/2024 21:52:35 (l3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|