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 CPP):

Solution:
#include <bits/stdc++.h>
unsigned long long mulmod(unsigned long long a, unsigned long long b,
                          unsigned long long m) {
  unsigned long long res = 0;
  while (a) {
    if (a & 1) {
      if (b >= m - res) res -= m;
      res += b;
    }
    a >>= 1;
    unsigned long long tb = b;
    if (b >= m - b) tb -= m;
    b += tb;
  }
  return res;
}
unsigned long long modpow(unsigned long long a, unsigned long long b,
                          unsigned long long n) {
  unsigned long long result = 1;
  while (b > 0) {
    if (b % 2) result = mulmod(result % n, a % n, n);
    b >>= 1;
    a = mulmod(a % n, a % n, n);
  }
  return result;
}
bool mr(unsigned long long n) {
  const unsigned long long base[7] = {2,      325,     9375,      28178,
                                      450775, 9780504, 1795265022};
  if (n == 0) return false;
  if (n <= 3) return true;
  unsigned long long d = n - 1;
  int s = 0;
  while (d % 2 == 0) s++, d >>= 1;
  for (int i = 0; i < 7; i++) {
    if (base[i] % n == 0) continue;
    unsigned long long a = base[i];
    if (modpow(a, d, n) == 1) continue;
    bool found = false;
    for (int r = 0; r < s && !found; r++) {
      if (modpow(a, (1ull << r) * d, n) == n - 1) found = true;
    }
    if (!found) return false;
  }
  return true;
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return !b ? a : gcd(b, a % b);
}
unsigned long long prho(unsigned long long n) {
  int i = 0, k = 2;
  unsigned long long x = 3, y = 3;
  if (mr(n)) return n;
  if (n < 50000) {
    for (int i = 2; i < 50000; i++) {
      if (n % i == 0) return i;
    }
  }
  while (true) {
    i++;
    x = (mulmod(x, x, n) + n - 1) % n;
    unsigned long long delta;
    if (x > y)
      delta = x - y;
    else
      delta = y - x;
    unsigned long long d = gcd(delta, n);
    if (d != 1 && d != n) return d;
    if (i == k) y = x, k *= 2;
  }
}
int64_t bs(int64_t a, int64_t b, int64_t t) {
  if (a > b) a = b;
  if (b < a) b = a;
  if (a == b) {
    if (a * (a - 1) == t) return a;
    return -1;
  }
  int64_t c = (a + b + 1) / 2;
  int64_t v = c * (c - 1);
  if (v > t) return bs(a, c - 1, t);
  if (v < t)
    return bs(c + 1, b, t);
  else
    return c;
}
void factor(int64_t N, std::map<int64_t, int> &pf) {
  uint64_t fac = prho(N);
  if (fac == N) {
    pf[N]++;
    return;
  } else
    factor(fac, pf), factor(N / fac, pf);
}
int64_t N;
std::set<int64_t> results;
void try_factors(std::map<int64_t, int>::iterator &i,
                 const std::map<int64_t, int>::iterator &end, int64_t acc) {
  if (end == i) {
    int64_t nn = N;
    nn /= acc;
    if ((acc - 1) % 2 != 0) return;
    nn -= (acc - 1) / 2;
    nn++;
    if (__builtin_popcountll(nn) != 1) return;
    int64_t y = __builtin_ctz(nn);
    results.insert(acc * nn);
    return;
  }
  uint64_t pacc = 1;
  int max = i->second;
  uint64_t p = i->first;
  ++i;
  for (int j = 0; j <= max; j++) {
    try_factors(i, end, acc * pacc);
    pacc *= p;
  }
  --i;
}
int main() {
  std::cin >> N;
  std::map<int64_t, int> pf;
  factor(N, pf);
  auto it = pf.begin();
  try_factors(it, pf.end(), 1);
  if (results.size() == 0) {
    std::cout << -1 << std::endl;
    return 0;
  }
  for (auto i : results) std::cout << i << std::endl;
  return 0;
}