546. Stadium and Games

0

Medium

Daniel is arranging a football tournament with a specific format. Initially, the teams are split into pairs and play one game per pair. The loser of each pair is eliminated, and this process continues until there is an odd number of teams remaining. If there is only one team left, it is declared the winner and the tournament ends. Otherwise, the remaining teams play a round-robin tournament, where each team plays against each other once. The tournament ends after this round-robin stage. Daniel has already booked the stadium for a certain number of games, denoted by 'n'. Your task is to help him determine the number of teams he should invite so that the tournament requires exactly 'n' games. You need to output all possible numbers of invited teams in ascending order, or -1 if there are no such numbers.

Input Format

The first line contains a single integer 'n', representing the number of games that should be played.

Output Format

Print all possible numbers of invited teams in ascending order, one per line. If it is not possible to play exactly 'n' games, output -1.

Example

Input

25

Output

20

Constraints

1 <= n <= 10^18

Loading...

View Submissions

Console