Alice, the mathematician, likes to study real numbers that are between 0 and 1. Her favourite tool is the filter.
A filter covers part of the number line. When a number reaches a filter, two events can happen. If a number is not covered by the filter, the number will pass through. If a number is covered, the number will be removed.
Alice has infinitely many filters. Her first 3 filters look like this:
In general, the k-th filter can be defined as follows:
Alice has instructions for constructing the Cantor set. Start with the number line from 0 to 1. Apply all filters on the number line, and remove the numbers that are covered. The remaining numbers form the Cantor set.
Alice wants to research the Cantor set, and she came to you for help. Given an integer N, Alice would like to know which fractions Nx are in the Cantor set.
The first line contains the integer N.
Output all integers x where 0≤x≤N and Nx is in the Cantor set.
Output the answers in increasing order. The number of answers will not exceed 106.