#Q201. 「一本通 6.2 练习 2」轻拍牛头

「一本通 6.2 练习 2」轻拍牛头

Description

Original source: USACO 2008 Dec. Silver

Today is Bessie's birthday, and it's time for party games. Bessie has arranged for NN cows numbered 1N1\sim N to sit in a circle (so except for the last cow, the ii-th cow is adjacent to the (i1)(i-1)-th and (i+1)(i+1)-th cows, and the NN-th cow is adjacent to the (N1)(N-1)-th and the 11-st cow). Meanwhile, Farmer John brings a bucket containing a billion small slips of paper, each with an integer between [1,106][1,10^6] written on it.

Next, each cow takes turns drawing a number Ai (1Ai106)A_i\ (1\le A_i\le 10^6) from the massive bucket (these numbers do not need to be distinct). Then, the ii-th cow walks around the circle, and if the number in cow ii's hand is divisible by the number in cow jj's hand (ji)(j\neq i), cow ii will pat cow jj on the head. After completing the circle, cow ii returns to its original position.

The cows want you to help them calculate, for each cow, how many cows it needs to pat on the head?

Input Format

The first line contains an integer NN;
The next NN lines each contain an integer AiA_i.

Output Format

Output NN lines, where the ii-th line indicates the number of cows the ii-th cow needs to pat.

Sample 1

The first cow will pat the second and third cows, the second cow will pat no cows, and so on.

5
2
1
2
3
4

2
0
2
1
3

Data Range and Hints

For all data, 1N1051\le N\le 10^5.