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>
using namespace std;
using namespace std;
const int MAXP = 2000;
int primes[MAXP + 1], pN;
bool isPrime[MAXP + 1];
pair<unsigned long long, int> factors[69];
int fN;
void preprocess() {
  int i, j;
  memset(isPrime, true, sizeof(isPrime));
  isPrime[0] = isPrime[1] = false;
  for (i = 2; i <= MAXP; ++i)
    if (isPrime[i]) {
      primes[pN++] = i;
      for (j = i + i; j <= MAXP; j += i) isPrime[j] = false;
    }
}
unsigned long long modMul(unsigned long long a, unsigned long long b,
                          unsigned long long n) {
  unsigned long long p = 8, len = 61, dig, back = 0, temp = a % n;
  for (; p < n; len -= 4, p <<= 4)
    ;
  dig = ((unsigned long long)1 << len) - 1;
  for (; b > 0; b >>= len) {
    if (b & dig) {
      if ((back += temp * (b & dig)) > n) back %= n;
    }
    if ((temp <<= len) > n) temp %= n;
  }
  return back;
}
unsigned long long modExp(unsigned long long a, unsigned long long b,
                          unsigned long long n) {
  unsigned long long z = 1;
  do {
    if (b & 1) z = modMul(z, a, n);
    a = modMul(a, a, n);
  } while (b >>= 1);
  return z;
}
bool millerRabin(unsigned long long n) {
  if (n == 2) return true;
  if (n < 2 || !(n & 1)) return false;
  int j, k = 0;
  unsigned long long m = n - 1, a;
  for (; !(m & 1); m >>= 1, ++k)
    ;
  for (int i = 0; i < 5; ++i) {
    a = modExp((unsigned long long)rand() * rand() * rand() % (n - 1) + 1, m,
               n);
    if (a == 1) continue;
    for (j = 0; j < k; ++j, a = modMul(a, a, n))
      if (a == n - 1) break;
    if (j >= k) return false;
  }
  return true;
}
inline unsigned long long gcd(unsigned long long a, unsigned long long b) {
  unsigned long long t;
  while (b) {
    t = b;
    b = a % b;
    a = t;
  }
  return a;
}
inline unsigned long long f(unsigned long long x, unsigned long long n) {
  unsigned long long xx = modMul(x, x, n) + 1;
  return xx == n ? 0 : xx;
}
unsigned long long brent(unsigned long long n) {
  if (n < 2) return 0;
  if (!(n & 1)) return 2;
  const static int MAXL = 10;
  unsigned long long k, g, x, y, q, r, ys;
  for (int i = 0; i < 10; ++i) {
    y = (unsigned long long)rand() * rand() * rand() % n;
    r = q = 1;
    do {
      x = y;
      for (int j = 0; j < r; ++j) y = f(y, n);
      k = 0;
      do {
        ys = y;
        int a = MAXL > r - k ? r - k : MAXL;
        for (int l = 0; l < a; ++l) {
          y = f(y, n);
          q = modMul(q, (x - y + n) % n, n);
        }
        g = gcd(q, n);
        k += MAXL;
      } while (k < r && g <= 1);
      r += r;
    } while (g <= 1);
    if (g == n) {
      do {
        ys = f(ys, n);
        g = gcd((x - ys + n) % n, n);
      } while (g <= 1);
    }
    if (g != n) return g;
  }
  return 0;
}
void getFactors(unsigned long long n) {
  int i, c;
  fN = 0;
  for (i = 0; i < pN && primes[i] * primes[i] <= n; ++i)
    if (n % primes[i] == 0) {
      c = 0;
      while (n % primes[i] == 0) {
        n /= primes[i];
        ++c;
      }
      factors[fN++] = make_pair((unsigned long long)primes[i], c);
    }
  while (n > 1) {
    unsigned long long p = n;
    while (!millerRabin(p)) p = brent(p);
    c = 0;
    while (n % p == 0) {
      n /= p;
      ++c;
    }
    factors[fN++] = make_pair(p, c);
  }
  sort(factors, factors + fN);
}
vector<unsigned long long> ans;
void dfs(int depth, unsigned long long value, unsigned long long n) {
  if (depth >= fN) {
    unsigned long long v = value;
    if (v > 2000000000 || n < v * (v - 1) / 2) {
      return;
    } else if ((n - v * (v - 1) / 2) % v != 0) {
      return;
    } else {
      unsigned long long t = (n - v * (v - 1) / 2) / v;
      if ((t & (t + 1)) == 0) {
        ans.push_back(v * (t + 1));
      }
    }
  } else {
    unsigned long long k = 1;
    for (int i = 0; i <= factors[depth].second; ++i) {
      dfs(depth + 1, value * k, n);
      k *= factors[depth].first;
    }
  }
}
int main() {
  preprocess();
  unsigned long long n;
  cin >> n;
  if (millerRabin(n)) {
    factors[fN++] = make_pair(n, 1);
  } else {
    getFactors(n);
  }
  dfs(0, 1, n);
  if (ans.size() == 0) {
    cout << -1 << endl;
  } else {
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); ++i) {
      cout << ans[i] << endl;
    }
  }
  return 0;
}