#P1514C. Product 1 Modulo N
Product 1 Modulo N
Description
Now you get Baby Ehab's first words: "Given an integer , find the longest subsequence of whose product is modulo ." Please solve the problem.
A sequence is a subsequence of an array if can be obtained from by deleting some (possibly all) elements. The product of an empty subsequence is equal to .
The only line contains the integer ().
The first line should contain a single integer, the length of the longest subsequence.
The second line should contain the elements of the subsequence, in increasing order.
If there are multiple solutions, you can print any.
Input
The only line contains the integer ().
Output
The first line should contain a single integer, the length of the longest subsequence.
The second line should contain the elements of the subsequence, in increasing order.
If there are multiple solutions, you can print any.
Note
In the first example, the product of the elements is which is congruent to modulo . The only longer subsequence is . Its product is which is congruent to modulo . Hence, the answer is .