Laws

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

There are two inhabitants in the Faraway Kingdom: Alyonushka the Peasant and Ivanushka the King. Alyonushka works on a farm, and Ivanushka makes laws.

Alyonushka has xx coins. Each day, Alyonushka gets one more coin from the treasury for her work. The amount of coins in the treasury can be considered infinite.

If the number of Alyonushka's coins divides evenly by two, Ivanushka can make another peasant law, and Alyonushka will be allowed to keep only half of her coins: the other half immediately goes to the treasury. If the number of Alyonushka's coins divides evenly by three, Ivanushka can make another farm law, and Alyonushka will be allowed to keep only one third of her coins: the other two thirds immediately go to the treasury. Ivanushka can make new laws at any moment, in any order, and do it any number of times.

Today Ivanushka got angry with Alyonushka. Now he wishes Alyonushka to have only one coin left. What is the minimum possible number of days required to achieve that?

입력

The first line of input contains an integer xx: the initial number of Alyonushka's coins (1x1091 \le x \le 10^{9}).

출력

On the first line, print tt: the minimum possible number of days required for Ivanushka to leave Alyonushka with only one coin. On the second line, print a sequence of integers: any possible sequence of events which takes tt days and transforms xx coins into 11. The sequence must start with xx and end with 11. Every two consecutive numbers uu and vv in the sequence must satisfy either v=u+1v = u + 1 (a day has passed), v=u/2v = u / 2 (a new peasant law has been made), or v=u/3v = u / 3 (a new farm law has been made).