eolymp
bolt
Try our new interface for solving problems
Problems

Jousting

Jousting

Once upon a time, there was a great jousting tournament. There were \textbf{n} knights competing (\textbf{n} = \textbf{2^k} for some integer \textbf{k}), whose names are now forgotten - modern historians number them \textbf{1}, \textbf{2}, ..., \textbf{n}. The tournament was held in a knock-out manner. In the first round the knight \textbf{1} beat knight \textbf{2}, knight \textbf{3} beat \textbf{4}, \textbf{5} beat \textbf{6} and so on. In the second round \textbf{1} won the match with \textbf{3}, \textbf{5} won the match with \textbf{7} etc. This continued until the end of the tournament: in every following round, every number was matched with one of its closest numbers (there is exactly one way to do that), and the lower number won. The tournament was (of course) won by knight \textbf{1}, who was crowned the champion. Assume that every competitor had an (unknown, but distinct) level of jousting skill and the better always won a duel. Obviously, the champion was the most skilled one. Your task is to find all knights that could have had the second-highest skill. \InputFile The first line contains the number of test cases t. The test cases follow. A test case contains one positive integer \textbf{n} ≤ \textbf{2^63} - the number of players in the tournament. \OutputFile For each test case, your program should write a single line containing first the number of possible silver medalists and then their numbers listed in increasing order.
Time limit 1 second
Memory limit 64 MiB
Input example #1
2
2
4
Output example #1
1 2
2 2 3
Source 2013 Petrozavodsk Winter Training Camp, Jagiellonian University Contest, January 25, Problem J