This page is still under construction.

Parts of this page are still being built. What you see may change.

Endless Candy Party

Time limit2sMemory limit128 MB

Summary
For each s from 1 to N, find the smallest day k on which exactly s tables share the same floor(b_i/k) candies per person.
Level

Medium7 of 10

Topics
Math, Hash map, Brute force
Solved
No attempts yet

Problem

Mirko loves parties, so he decided to throw them for his friends without end. He set up NN tables and put candy on every one of them: table ii holds bib_i candies. On the first day he invites one friend to each table, on the second day two friends to each table, on the third day three, and in general on day kk he invites kk friends to each table.

When the friends walk in, kk of them sit down at every table and split that table's candy equally among themselves, throwing away the candy that does not divide evenly. A person sitting at table ii on day kk therefore receives ⌊bi/k⌋\lfloor b_i / k \rfloor candies. After the split, a table only mingles with tables whose people received the same amount, so the tables fall into groups by the amount of candy per person.

For every ss from 11 to NN, Mirko wants to know the earliest day on which some group holds exactly ss tables. Write a program that reports all NN answers.

Mirko refills every table to its original amount before each party starts, and everyone from one party leaves before the next one begins.

Input

The first line contains the integer NN, the number of tables. (1≤N≤1001 \le N \le 100)

The second line contains the integers b1,b2,…,bNb_1, b_2, \dots, b_N separated by spaces, where bib_i is the number of candies on table ii. (1≤bi≤1081 \le b_i \le 10^8)

Output

Print NN lines. Line ss contains the number of the earliest day on which a group of exactly ss tables mingles together, or −1-1 if that day never comes.

Hint

In the first example, no two tables give the same amount per person on day 1, so every table forms a group of one and the answer for size 1 is 1. On day 2, tables 1 and 2 both give 5 candies per person and mingle, so the answer for size 2 is 2. On day 3, tables 1, 2 and 3 all give 3 candies per person. On day 6, tables 1 to 4 all give 1 candy per person. On day 12, every table gives 0 candies per person, so all five tables become one group.

In the second example, all tables hold the same amount of candy, so the amount per person is always the same. A group smaller than 3 never appears.

Examples3

  1. Example 1

    Input
    5
    11 10 9 6 4
    
    Expected output
    1
    2
    3
    6
    12
    
  2. Example 2

    Input
    3
    5 5 5
    
    Expected output
    -1
    -1
    1
    
  3. Example 3

    Input
    8
    12 16 95 96 138 56 205 84
    
    Expected output
    1
    5
    14
    49
    96
    97
    139
    206