Suki's Identical Treat Bundles
Suki, a black curly-coated dog with a grey beard and white paws, has hidden treats of n different kinds all around the garden: c_i treats of kind i. Before her walks she wants to dig them all up and pack them into bundles, one bundle per walk, and she wants as many walks as possible.
Every bundle must be identical: each one holds the same number of treats of kind 1, the same number of kind 2, and so on. Every treat must go into some bundle, so none is left over.
Find the largest possible number of bundles, and how many treats of each kind go into one bundle.
Input
The first line contains n (1 ≤ n ≤ 10^5), the number of kinds of treats.
The second line contains n integers c_1, c_2, …, c_n (1 ≤ c_i ≤ 10^12), the number of treats of each kind.
Output
On the first line print k, the largest number of bundles.
On the second line print n integers: the number of treats of kind 1, kind 2, …, kind n in one bundle.
Notes
In the first example, Suki has 12, 18 and 30 treats. She can make 6 bundles of 2, 3 and 5 treats. She can't make more: 7, 8, 9, 10, 11 and 12 bundles all fail to split 12 or 18 evenly, and there can't be more bundles than she has treats of kind 1.
In the second example, 7 and 10 share no common divisor other than 1, so all the treats go into a single bundle.
In the third example, Suki has only one kind of treat, so each of the 10^12 treats becomes its own bundle. Counts and the number of bundles can exceed 2^31: use a 64-bit integer type.