Problem: Daniel is organizing a football tournament. He has come up with the following tournament format: 

  1. In the first several (possibly zero) stages, while the number of teams is even, they split in pairs and play one game for each pair. At each stage the loser of each pair is eliminated (there are no draws). Such stages are held while the number of teams is even. 
  2. Eventually there will be an odd number of teams remaining. If there is one team remaining, it will be declared the winner, and the tournament ends. Otherwise each of the remaining teams will play with each other remaining team once in round robin tournament (if there are x teams, there will be <image> games), and the tournament ends. 



For example, if there were 20 teams initially, they would begin by playing 10 games. So, 10 teams would be eliminated, and the remaining 10 would play 5 games. Then the remaining 5 teams would play 10 games in a round robin tournament. In total there would be 10+5+10=25 games.

Daniel has already booked the stadium for n games. Help him to determine how many teams he should invite so that the tournament needs exactly n games. You should print all possible numbers of teams that will yield exactly n games in ascending order, or -1 if there are no such numbers.

Input

The first line contains a single integer n (1 ≤ n ≤ 1018), the number of games that should be played.

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Output

Print all possible numbers of invited teams in ascending order, one per line. If exactly n games cannot be played, output one number: -1.

Examples

Input

3


Output

3
4


Input

25


Output

20


Input

2


Output

-1

Solution (in JAVA):

Solution:
import java.io.*;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.math.BigInteger.ONE;
import static java.math.BigInteger.ZERO;

public class B implements Runnable {

    // leave empty to read from stdin/stdout
    private static final String TASK_NAME_FOR_IO = "";

    // file names
    private static final String FILE_IN = TASK_NAME_FOR_IO + ".in";
    private static final String FILE_OUT = TASK_NAME_FOR_IO + ".out";

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tokenizer = new StringTokenizer("");

    public static void main(String[] args) {
        new Thread(new B()).start();
    }

    BigInteger TWO = new BigInteger("2");
    BigInteger FOUR = new BigInteger("4");

    BigInteger sqrt(BigInteger n) {
        BigInteger l = ONE;
        BigInteger r = n;
        while (l.add(FOUR).compareTo(r) < 0) {
            BigInteger m = l.add(r).divide(TWO);
            if (m.multiply(m).compareTo(n) < 0) {
                l = m;
            } else {
                r = m;
            }
        }
        while (l.compareTo(r) <= 0) {
            if (l.multiply(l).compareTo(n) == 0) {
                return l;
            }
            l = l.add(ONE);
        }
        return ONE.negate();
    }

    private void solve() throws IOException {
        BigInteger n = nextBigInt();
        TreeSet<BigInteger> result = new TreeSet<BigInteger>();
        for (int p = 0; p < 100; p++) {

            BigInteger p2 = TWO.pow(p);

            BigInteger a = ONE;
            BigInteger b = TWO.multiply(TWO.pow(p).subtract(ONE)).subtract(ONE);
            BigInteger c = TWO.multiply(n).negate();

            BigInteger d = b.multiply(b).subtract(FOUR.multiply(a).multiply(c));
            if (d.compareTo(ZERO) >= 0) {
                d = sqrt(d);
                if (d.compareTo(ZERO) < 0) continue;

                {
                    BigInteger x = b.negate().subtract(d).divide(a.multiply(TWO));
                    add(p2.multiply(x), result, n);
                }

                {
                    BigInteger x = b.negate().add(d).divide(a.multiply(TWO));
                    add(p2.multiply(x), result, n);
                }
            }

        }

        if (result.size() == 0) {
            out.println(-1);
        } else {
            for (BigInteger p : result) {
                out.println(p.toString());
            }
        }
    }

    private void add(BigInteger k, TreeSet<BigInteger> result, BigInteger n) {
        BigInteger kOrig = k;

        if (k.compareTo(ZERO) <= 0) {
            return;
        }

        BigInteger total = ZERO;
        while (k.compareTo(ONE) > 0 && k.mod(TWO).compareTo(ZERO) == 0) {
            total = total.add(k.divide(TWO));
            k = k.divide(TWO);
        }

        total = total.add(k.multiply(k.subtract(ONE)).divide(TWO));
        if (total.compareTo(n) == 0) {
            result.add(kOrig);
        }
    }

    public void run() {
        long timeStart = System.currentTimeMillis();

        boolean fileIO = TASK_NAME_FOR_IO.length() > 0;
        try {

            if (fileIO) {
                in = new BufferedReader(new FileReader(FILE_IN));
                out = new PrintWriter(new FileWriter(FILE_OUT));
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }

            solve();

            in.close();
            out.close();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        long timeEnd = System.currentTimeMillis();

        if (fileIO) {
            System.out.println("Time spent: " + (timeEnd - timeStart) + " ms");
        }
    }

    private String nextToken() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private BigInteger nextBigInt() throws IOException {
        return new BigInteger(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}