#0001C9

z-lisnogcd

You are given a sequence of N integers. You have to find the longest non-decreasing subsequence such that for all pairs (a,b) of the numbers in the sequence gcd(a,b) = 1



InputFrom the first line of the standard input read one integer N (1 <= N <= 1000). From the next line read N integers that represent the sequence. Each element will be in the interval [1, 2000000000]


OutputTo the first line of the standard output write one integer M representing the length of the longest non-decreasing sequence with the property described above. To the next line write the M indices of the sequence you have found (separated by a space). The sequence is zero indexed, the first element has an index of 0. If there are multiple solutions with the same maximal length you can output any of them.


Input:
5
1 2 2 4 3

Output:
3
0 2 4

The elements in the sequence are 1, 2 and 3


Input:
5
1 2 2 4 3

Output:
3
0 1 4

The elements in the sequence are 1, 2 and 3


Input:
6
4 8 12 3 6 9

Output:
2
0 5

The elements in the sequence are 4 and 9


Input:
6
4 8 12 3 6 9

Output:
2
1 5

The elements in the sequence are 8 and 9

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.