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;
const int N = 100010;
const int TEN = 10000;
class BIG {
 public:
  vector<int> num;
  BIG();
  BIG(long long x);
  BIG(char *x);
  BIG(string &x);
  void set(int x);
  void set(char *x);
  bool operator<(const BIG &o);
  bool operator<=(const BIG &o);
  BIG operator+(const BIG &o);
  BIG operator*(const BIG &o);
  BIG operator-(const BIG &o);
  BIG operator/(int x);
  BIG operator/(const BIG &o);
  int operator%(int x);
  BIG operator%(const BIG &o);
  BIG operator^(int x);
  void draw();
  BIG operator+=(const BIG &o) { return *this + o; }
  BIG operator-=(const BIG &o) { return *this - o; }
  BIG operator*=(const BIG &o) { return *this * o; }
  BIG operator/=(const BIG &o) { return *this / o; }
  BIG operator/=(int x) { return *this / x; }
  BIG operator%=(const BIG &o) { return *this % o; }
  BIG operator%=(const BIG x) { return *this % x; }
  BIG operator^=(int x) { return *this ^ x; }
};
BIG ZERO = BIG(0LL), ONE = BIG(1LL), TWO = BIG(2LL), THREE = BIG(3LL),
    FOUR = BIG(4LL);
BIG _retadd;
BIG _retmul;
BIG _retsub;
BIG _retdiv1;
BIG _retmod1;
BIG _retmod2, _tmpmod2;
BIG _l, _r, _mid, _tmpdiv, _retdiv2;
BIG _dd, _retpow;
BIG::BIG() {
  num.clear();
  num.push_back(0);
}
BIG::BIG(long long x) {
  num.clear();
  if (!x) num.push_back(0);
  while (x) {
    num.push_back(x % TEN);
    x /= TEN;
  }
}
BIG::BIG(char *x) {
  num.clear();
  int nid = strlen(x), tmp = 0, tmp_ten;
  while (true) {
    tmp = 0, tmp_ten = 1;
    while (nid && tmp_ten < TEN) {
      tmp = tmp + tmp_ten * (x[--nid] - 48);
      tmp_ten *= 10;
    }
    num.push_back(tmp);
    if (nid <= 0) break;
  }
}
BIG::BIG(string &x) {
  num.clear();
  int nid = x.length(), tmp, tmp_ten;
  while (true) {
    tmp = 0, tmp_ten = 1;
    while (nid && tmp_ten < TEN) {
      tmp = tmp + tmp_ten * (x[--nid] - 48);
      tmp_ten *= 10;
    }
    num.push_back(tmp);
    if (nid <= 0) break;
  }
}
void BIG::set(int x) {
  num.clear();
  if (!x) num.push_back(0);
  while (x) {
    num.push_back(x % TEN);
    x /= TEN;
  }
}
void BIG::set(char *x) {
  num.clear();
  int nid = strlen(x), tmp = 0, tmp_ten;
  while (true) {
    tmp = 0, tmp_ten = 1;
    while (nid && tmp_ten < TEN) {
      tmp = tmp + tmp_ten * (x[--nid] - 48);
      tmp_ten *= 10;
    }
    num.push_back(tmp);
    if (nid <= 0) break;
  }
}
bool BIG::operator<(const BIG &o) {
  if (num.size() != o.num.size()) return num.size() < o.num.size();
  for (int i = num.size(); i--;)
    if (num[i] != o.num[i]) return num[i] < o.num[i];
  return false;
}
bool BIG::operator<=(const BIG &o) {
  if (num.size() != o.num.size()) return num.size() < o.num.size();
  for (int i = num.size(); i--;)
    if (num[i] != o.num[i]) return num[i] < o.num[i];
  return true;
}
BIG BIG::operator+(const BIG &o) {
  _retadd.num.clear();
  int u = 0, len1, len2, i;
  len1 = num.size();
  len2 = o.num.size();
  _retadd.num.resize((len1 > len2 ? len1 : len2));
  for (i = 0; i < _retadd.num.size(); i++) {
    u = (i < len1 ? num[i] : 0) + (i < len2 ? o.num[i] : 0) + u / TEN;
    _retadd.num[i] = u % TEN;
  }
  u /= TEN;
  if (u) _retadd.num.push_back(u);
  return _retadd;
}
BIG BIG::operator*(const BIG &o) {
  _retmul.num.clear();
  int len1, len2, i, j, x;
  len1 = num.size();
  len2 = o.num.size();
  _retmul.num.resize(len1 + len2);
  for (i = 0, x = 0; i < len1; i++, x = 0) {
    for (j = 0; j < len2; j++) {
      x = num[i] * o.num[j] + x / TEN + _retmul.num[i + j];
      _retmul.num[i + j] = x % TEN;
    }
    _retmul.num[i + len2] = x / TEN;
  }
  while (_retmul.num.size() > 1 && !_retmul.num.back()) _retmul.num.pop_back();
  return _retmul;
}
BIG BIG::operator-(const BIG &o) {
  _retsub.num.clear();
  int i, len1 = num.size(), len2 = o.num.size();
  _retsub.num.resize(len1);
  for (i = 0; i < len1; i++) {
    _retsub.num[i] += num[i] - (i < len2 ? o.num[i] : 0);
    if (_retsub.num[i] < 0) {
      _retsub.num[i + 1]--;
      _retsub.num[i] += TEN;
    }
  }
  while (_retsub.num.size() > 1 && !_retsub.num.back()) _retsub.num.pop_back();
  return _retsub;
}
BIG BIG::operator/(int x) {
  _retdiv1.num.clear();
  _retdiv1.num.resize(num.size());
  int f = 0, i;
  for (i = num.size(); i--;) {
    f = f * TEN + num[i];
    _retdiv1.num[i] = f / x;
    f %= x;
  }
  while (_retdiv1.num.size() > 1 && !_retdiv1.num.back())
    _retdiv1.num.pop_back();
  return _retdiv1;
}
int BIG::operator%(int x) {
  int f = 0, i;
  for (i = num.size(); i--;) {
    f = f * TEN + num[i];
    _retdiv1.num[i] = f / x;
    f %= x;
  }
  return f;
}
BIG BIG::operator/(const BIG &o) {
  if (*this < o) return ZERO;
  _retdiv2.num.clear();
  _r = *this;
  _l.set(1);
  while (_l <= _r) {
    _mid = (_l + _r) / 2, _tmpdiv = _mid * o;
    if ((*this) < _tmpdiv) {
      _r = _mid - ONE;
    } else {
      _retdiv2 = _mid;
      _l = _mid + ONE;
    }
  }
  return _retdiv2;
}
BIG BIG::operator%(const BIG &o) { return *this - (*this / o) * o; }
BIG BIG::operator^(int x) {
  _retpow.set(1);
  _dd = *this;
  while (x) {
    if (x & 1) _retpow = _retpow * _dd;
    _dd = _dd * _dd;
    x >>= 1;
  }
  return _retpow;
}
void BIG::draw() {
  int now;
  printf("%d", num.back());
  for (int i = num.size() - 1; i--;) {
    now = TEN / 10;
    while (now >= 10) {
      if (num[i] < now) putchar('0');
      now /= 10;
    }
    printf("%d", num[i]);
  }
  puts("");
}
vector<BIG> ans;
int r[N];
bool cmpr(int i, int j) { return ans[i] < ans[j]; }
int main() {
  long long n;
  cin >> n;
  long long x = sqrt(2 * n);
  int find = 0;
  if (x * (x + 1) == n * 2) {
    if (x % 2 == 0) {
      ans.push_back(BIG(x + 1));
      find = 1;
    }
  }
  long long tp = 1, k = 0;
  while (tp * 2 - 1 <= n) {
    long long l = 1, r = n / (tp * 2 - 1) + 1;
    while (l < r) {
      long long mid = (l + r) / 2;
      BIG hh = BIG(tp * 2 - 1) * BIG(mid) + BIG(mid) * BIG(mid - 1) / BIG(2LL);
      if (BIG(n) < hh) {
        r = mid;
      } else if (hh < BIG(n)) {
        l = mid + 1;
      } else {
        if (mid % 2 == 1) {
          ans.push_back(BIG(mid) * BIG(tp) * BIG(2LL));
          find = 1;
        }
        break;
      }
    }
    tp *= 2;
    k++;
  }
  if (!find)
    puts("-1");
  else {
    int K = ans.size();
    for (int i = 0; i < K; i++) r[i] = i;
    sort(r, r + K, cmpr);
    for (int i = 0; i < K; i++) ans[r[i]].draw();
  }
  return 0;
}