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.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

import static java.math.BigInteger.valueOf;

/**
 * @author kperikov
 */
public class Main implements Runnable {

    PrintWriter out;
    BufferedReader br;
    StringTokenizer st;

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

    public String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new BufferedOutputStream(System.out));
            solve();
            out.close();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }

    public void solve() throws IOException {
        long n = nextLong();
        ArrayList<Long> res = new ArrayList<Long>();
        for (int s = 0; s <= 70; ++s) {
            long ans = binSearch(calcB(s).negate().divide(BigInteger.valueOf(2L)).longValue(), (long) Math.pow(10, 18), n, s);
            if (ans != -1) {
                res.add(ans);
            }
            ans = binSearch(0L, calcB(s).negate().divide(BigInteger.valueOf(2L)).longValue(), n, s);
            if (ans != -1) {
                res.add(ans);
            }
        }
        if (res.size() > 0) {
            Collections.sort(res);
            for (int i = 0; i < res.size(); ++i) {
                out.println(res.get(i));
            }
        } else {
            out.println(-1);
        }
    }

    private long binSearch(long left, long right, long n, int s) {
        BigInteger resLeft = solveEq(n, valueOf(left), s);
        if (resLeft.compareTo(BigInteger.ZERO) == 0) {
            return left;
        }
        BigInteger resRight = solveEq(n, valueOf(right), s);
        if (resRight.compareTo(BigInteger.ZERO) == 0) {
            return right;
        }
        while (left <= right) {
            BigInteger mid = valueOf(left).add(valueOf(right)).divide(valueOf(2L));
            BigInteger result = solveEq(n, mid, s);
            if (result.compareTo(BigInteger.ZERO) == 0 && checkCorrectS(mid, s, n) && mid.longValue() != 0) {
                return mid.longValue();
            } else if (result.compareTo(BigInteger.ZERO) > 0) {
                right = mid.longValue() - 1;
            } else {
                left = mid.longValue() + 1;
            }
        }
        return -1;
    }

    private boolean checkCorrectS(BigInteger mid, int s, long n) {
        int test = 0;
        long tst = mid.longValue();
        if (tst == 0) {
            return false;
        }
        while (tst % 2 == 0) {
            ++test;
            tst /= 2;
        }
        if (test != s) {
            return false;
        }
        return true;
    }

    private BigInteger solveEq(long n, BigInteger mid, int s) {
        BigInteger result;
        BigInteger c = calcC(n, s);
        BigInteger b = calcB(s);
        result = mid.multiply(mid).add(b.multiply(mid)).add(c);
        return result;
    }

    private BigInteger calcC(long n, int s) {
        return valueOf(n).multiply(BigInteger.valueOf(-2L)).multiply(BigInteger.valueOf(2L).pow(2 * s));
    }

    private BigInteger calcB(int s) {
        return valueOf(2L).pow(2 * s + 1).subtract(BigInteger.valueOf(3).multiply(valueOf(2L).pow(s)));
    }

    public int radius(String[] grid) {
        int n = grid.length;
        int m = grid[0].length();
        int[][] g = new int[n][m];
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                if (grid[i].charAt(j) == '#') {
                    g[i][j] = 1;
                }
            }
        }
        int ans = 0;
        for (int i = 0; i < n + 1; ++i) {
            for (int j = 0; j < m + 1; ++j) {
                // try to draw circle from (i,j);
                int maxR = Math.min(n - i - 1, Math.min(m - j - 1, Math.min(i, j)));
                for (int k = 1; k <= maxR; ++k) {
                    boolean isOk = true;
                    for (int a1 = 0; a1 < n; ++a1) {
                        for (int b1 = 0; b1 < m; ++b1) {
                            if (g[a1][b1] == 1) {
                                int x1 = a1;
                                int x2 = a1 + 1;
                                int y1 = b1;
                                int y2 = b1 + 1;
                                double x = Math.sqrt(k * k - x1 * x1);
                                if (Math.abs(x - x1) < 1e-8 || Math.abs(x - x2) < 1e-8) {

                                } else if (x >= x1 && x <= x2) {
                                    isOk = false;
                                }
                                x = Math.sqrt(k * k - x2 * x2);
                                if (Math.abs(x - x1) < 1e-8 || Math.abs(x - x2) < 1e-8) {

                                } else if (x >= x1 && x <= x2) {
                                    isOk = false;
                                }
                                double y = Math.sqrt(k * k - y1 * y1);
                                if (Math.abs(y - y1) < 1e-8 || Math.abs(y - y2) < 1e-8) {

                                } else if (y >= y1 && y <= y2) {
                                    isOk = false;
                                }
                                y = Math.sqrt(k * k - y2 * y2);
                                if (Math.abs(y - y1) < 1e-8 || Math.abs(y - y2) < 1e-8) {

                                } else if (y >= y1 && y <= y2) {
                                    isOk = false;
                                }
                            }
                        }
                    }
                    if (isOk) {
                        ans = Math.max(k, ans);
                    }
                }
            }
        }
        return ans;
    }


}