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.util.*;
import java.math.*;
import java.io.*;


public class Main {
    BigInteger MAX = BigInteger.valueOf((long) 1e18);


    void solve() throws Exception {
        TreeSet<BigInteger> fin = new TreeSet();
        long n1= nl();
        for (int i = 0; i <= 65; i++){
            BigInteger a = bi(1);
//          BigInteger b = bi(3);
            BigInteger b = bi(2).pow(i + 1).subtract(bi(3));
            BigInteger c = bi(-n1).multiply(bi(2));
//          BigInteger c = bi(n1).multiply(bi(2)).add(bi(2).pow(i + 1));
//          px(a,b,c);
            BigInteger delta = b.pow(2).subtract(bi(4).multiply(a).multiply(c));
//          px(delta, flrSqrt(delta));
            if (delta.compareTo(bi(0)) < 0){
                continue;
            }
            BigInteger sqrt = flrSqrt(delta);
            if (!sqrt.pow(2).equals(delta)){
                continue;
            }
            BigInteger bot = a.multiply(bi(2));
            {
                BigInteger top = b.multiply(bi(-1)).add(sqrt);
                if (top.remainder(bot).equals(bi(0))){
                    BigInteger cand = top.divide(bot);
                    if (cand.compareTo(bi(0)) >= 0){
                        if (cand.remainder(bi(2)).equals(BigInteger.ONE)){
                            cand = cand.multiply(bi(2).pow(i));
                            if (cand.compareTo(bi(0)) >= 0){
                                fin.add(cand);
                            }
                        }
                    }
                }
            }
            {
                BigInteger top = b.multiply(bi(-1)).subtract(sqrt);
                if (top.remainder(bot).equals(bi(0))){
                    BigInteger cand = top.divide(bot);
                    if (cand.compareTo(bi(0)) >= 0){
                        if (cand.remainder(bi(2)).equals(BigInteger.ONE)){
                            cand = cand.multiply(bi(2).pow(i));
                            if (cand.compareTo(bi(0)) >= 0){
                                fin.add(cand);
                            }
                        }
                    }
                }
            }




        }
        if (fin.size() == 0){
            out.println(-1);
        }
        else {
            for (BigInteger e: fin){
                out.println(e);
            }
        }

    }
    BigInteger flrSqrt(BigInteger n1){
        BigInteger low = bi(1);
        BigInteger high = n1;
        for (;high.subtract(low).compareTo(bi(1)) > 0;){
            BigInteger mid = low.add(high).divide(bi(2));
            BigInteger pow = mid.pow(2);
            int sign = n1.compareTo(pow);
//          px(n1, low, high, mid, pow);
            if (sign >= 0){
                low = mid;
            }
            else {
                high = mid;
            }

        }
        return low;


    }

    BigInteger bi(long n1){
        return BigInteger.valueOf(n1);
    }

    public static void main(String[] args) throws Exception {new Main();}

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;

    String nx() throws Exception {
        for (; st == null || !st.hasMoreTokens(); ) {
            String k1 = in.readLine();
            if (k1 == null) return k1;
            st = new StringTokenizer(k1);
        }
        return st.nextToken();
    }

    int ni() throws Exception {
        return Integer.parseInt(nx());
    }

    long nl() throws Exception {
        return Long.parseLong(nx());
    }

    double nd() throws Exception {
        return Double.parseDouble(nx());
    }

    PrintWriter out = new PrintWriter(System.out);

    Main() throws Exception {
        solve();
        out.flush();
    }

    static void px(Object... l1) {
        System.out.println(Arrays.deepToString(l1));
    }
}