On the first line, print the minimum number of operations.
On the second line, print the numbers you pass through while turning N into 1, separated by single spaces and in order. The first number is N and the last number is 1.
If several sequences achieve the minimum, print only the lexicographically smallest one. Every sequence that achieves the minimum has the same length, so compare two sequences from the front: the one with the smaller number at the first position where they differ comes first.