Under construction

Still being built. Things may change

Equal Numbers

Time limit3sMemory limit512 MB

Summary
For each k from 0 to n, find the fewest distinct values possible after multiplying k list elements by positive integers.
Level

Medium7 of 10

Topics
Number theory, Greedy, Sorting, Math
Solved
No attempts yet

Problem

You are given a list of nn integers a1,a2,…,ana_1, a_2, \ldots, a_n. In one operation you choose one element of the list and multiply it by any positive integer. The multiplier can be 11.

For every kk with 0≤k≤n0 \le k \le n, compute the minimum number of different integers the list can contain after kk operations.

Input

The first line contains one integer nn (1≤n≤3×1051 \le n \le 3 \times 10^5).

The second line contains nn integers aia_i (1≤ai≤1061 \le a_i \le 10^6), separated by spaces.

Output

Print n+1n+1 integers on one line, separated by spaces. The ii-th integer is the minimum number of different integers the list can contain after i−1i-1 operations.

Examples3

  1. Example 1

    Input
    6
    3 4 1 2 1 2
    
    Expected output
    4 4 3 3 2 2 1
    
  2. Example 2

    Input
    1
    1
    
    Expected output
    1 1
    
  3. Example 3

    Input
    5
    7 7 7 7 7
    
    Expected output
    1 1 1 1 1 1