Palindrome Bases

No attempts yetTime limit1sMemory limit256 MB

Problem

People have ten fingers, so we use base 10. For example, $257$ means $2 \times 10^2 + 5 \times 10^1 + 7 \times 10^0$, and each digit in base 10 ranges from $0$ to $9$.

Besides base 10, the bases used most often are base 2, base 8, and base 16. In base $b$, each digit ranges from $0$ to $b-1$, and going from right to left the weight of each position grows as $b^0, b^1, b^2, \dots$.

For example, the decimal number $9$ is written in several bases as follows.

  • Base 16: $9$
  • Base 8: $11$ ($1 \times 8^1 + 1 \times 8^0 = 9$)
  • Base 2: $1001$ ($1 \times 2^3 + 0 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 9$)

All three of these representations are palindromes. A palindrome is a sequence that reads the same forwards and backwards. English examples include "dad", "mom", and "racecar"; numeric examples include $9$, $11$, and $1001$.

Given a decimal integer $X$, write a program that finds every base $b$ ($2 \le b < X$) for which $X$ written in base $b$ is a palindrome.

Input

The first line contains an integer $X$. ($2 \le X \le 1{,}000{,}000{,}000$)

Output

Print every base $b$ for which $X$ written in base $b$ is a palindrome, one per line in increasing order. If there is no such $b$, print nothing.