Number Set
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
You are given a set of n positive integers. Find its largest subset A such that every number in A is a divisor of the product of all the other numbers in A.
Input
The first line contains single integer n (3 ≤ n ≤ 10^4). The second line contains n positive integers in strictly ascending order. None of these numbers exceeds 10^6.
Output
The first line should give the size of the largest subset A satisfying the condition. In the second line, you should list all the numbers in this subset in ascending order. If there is more than one subset satisfying the condition, output any one of them. You can rely on that it will be at least one such subset with at least three numbers.
Examples
Input #1
Answer #1
Submissions 339
Acceptance rate 12%