#include <bits/stdc++.h>
using namespace std;
FILE* in;
FILE* out;
class Long {
  friend Long operator+(long long left, Long const& right);
  friend Long operator-(long long left, Long const& right);
  friend Long operator*(long long left, Long const& right);

 private:
  int len, size, sign;
  int* num;
  void expand(void) {
    int* temp = new int[size * 2];
    memset(temp, 0, sizeof(temp[0]) * size * 2);
    memcpy(temp, num, sizeof(num[0]) * size);
    delete[] num;
    num = temp;
    size *= 2;
  }
  void normalize(void) {
    while (len > 1 && num[len - 1] == 0) len--;
  }
  int compare(const int* rnum, const int rlen) const {
    if (len != rlen) return len - rlen;
    for (int i = len - 1; i >= 0; i--)
      if (num[i] != rnum[i]) return num[i] - rnum[i];
    return 0;
  }
  void intAdd(int carry) {
    for (int i = 0; carry > 0 && i < len; i++) {
      carry += num[i];
      num[i] = carry % 1000000000;
      carry /= 1000000000;
    }
    while (carry) {
      if (len >= size) expand();
      num[len++] = carry % 1000000000;
      carry /= 1000000000;
    }
  }
  void intSub(int carry) {
    for (int i = 0; carry > 0 && i < len; i++) {
      num[i] -= carry;
      carry = 0;
      if (num[i] < 0) {
        num[i] += 1000000000;
        carry++;
      }
    }
    normalize();
  }
  void intMul(long long mul) {
    long long carry = 0;
    for (int i = 0; i < len; i++) {
      carry += mul * num[i];
      num[i] = carry % 1000000000;
      carry /= 1000000000;
    }
    while (carry) {
      if (len >= size) expand();
      num[len++] = carry % 1000000000;
      carry /= 1000000000;
    }
    normalize();
  }
  void intDiv(long long div) {
    long long carry = 0;
    for (int i = len - 1; i >= 0; i--) {
      carry = carry * 1000000000 + num[i];
      num[i] = (int)(carry / div);
      carry %= div;
    }
    normalize();
  }
  void intMod(long long mod) {
    long long carry = 0;
    for (int i = len - 1; i >= 0; i--) {
      carry = carry * 1000000000 + num[i];
      carry %= mod;
      num[i] = 0;
    }
    len = 1;
    num[0] = (int)carry;
  }
  void longAdd(Long& a, Long const& b) {
    int carry = 0, idx = 0;
    while (a.size < b.len) a.expand();
    for (int i = 0; i < b.len; i++) {
      carry += a.num[idx] + b.num[idx];
      a.num[idx++] = carry % 1000000000;
      carry /= 1000000000;
    }
    while (carry) {
      if (a.size <= idx) a.expand();
      carry += a.num[idx];
      a.num[idx++] = carry % 1000000000;
      carry /= 1000000000;
    }
    a.len = max(a.len, idx);
  }
  void longSub(Long& a, Long const& b) {
    int carry = 0;
    for (int i = 0; i < a.len; i++) {
      if (i < b.len)
        carry += b.num[i];
      else if (!carry)
        break;
      a.num[i] -= carry;
      carry = a.num[i] < 0 ? 1 : 0;
      a.num[i] += carry * 1000000000;
    }
    a.normalize();
  }
  void longMul(Long& a, Long const& b) {
    Long res, temp;
    for (int i = 0; i < b.len; i++) {
      temp = a;
      temp.intMul(b.num[i]);
      temp.len += i;
      while (temp.size < temp.len) temp.expand();
      for (int c = temp.len - 1; c >= i; c--) temp.num[c] = temp.num[c - i];
      for (int c = 0; c < i; c++) temp.num[c] = 0;
      longAdd(res, temp);
    }
    res.normalize();
    res.sign = a.sign;
    a = res;
  }
  void longDiv(Long& a, Long const& b) {
    Long leftLim, rightLim;
    rightLim.len = max(a.len - b.len + 1, 1);
    while (rightLim.size < rightLim.len) rightLim.expand();
    rightLim.num[rightLim.len - 1] = 1000000000 - 1;
    Long res, mid;
    while (leftLim <= rightLim) {
      mid = leftLim + rightLim;
      mid.intDiv(2);
      if (b * mid <= a) {
        if (res < mid) res = mid;
        leftLim = ++mid;
      } else
        rightLim = --mid;
    }
    res.sign = a.sign;
    a = res;
  }
  void longMod(Long& a, Long const& b) {
    Long temp(a);
    longDiv(temp, b);
    longMul(temp, b);
    longSub(a, temp);
  }
  void exp(Long& a, long long power) {
    Long mul(a);
    a = 1;
    while (power) {
      if (power & 1) a *= mul;
      mul *= mul;
      power >>= 1;
    }
  }
  void sqRoot() {
    Long leftLim, rightLim(*this);
    Long mid, res;
    while (leftLim <= rightLim) {
      mid = leftLim + rightLim;
      mid.intDiv(2);
      if (mid * mid <= *this) {
        if (res < mid) res = mid;
        leftLim = ++mid;
      } else
        rightLim = --mid;
    }
    res.sign = sign;
    *this = res;
  }

 public:
  Long() {
    size = 4;
    sign = 0;
    num = new int[size];
    len = 1;
    memset(num, 0, sizeof(num[0]) * size);
  }
  Long(long long init) {
    size = 4;
    num = new int[size];
    len = 0;
    memset(num, 0, sizeof(num[0]) * size);
    sign = init < 0 ? 1 : 0;
    init = init < 0 ? -init : init;
    do {
      num[len++] = init % 1000000000;
      init /= 1000000000;
    } while (init);
  }
  Long(string str) {
    sign = 0;
    if (str[0] == '-') {
      sign = 1;
      str = str.substr(1);
    }
    size = max(4, (int)str.size() / 9 + 1);
    num = new int[size];
    len = 0;
    memset(num, 0, sizeof(num[0]) * size);
    for (int start = (int)str.size() - 1; start >= 0; start -= 9) {
      num[len] = 0;
      for (int i = min(start, 9 - 1); i >= 0; i--)
        num[len] = num[len] * 10 + str[start - i] - 48;
      len++;
    }
    normalize();
  }
  Long(Long const& right) {
    len = right.len;
    size = right.size;
    sign = right.sign;
    num = new int[size];
    memcpy(num, right.num, sizeof(num[0]) * size);
  }
  ~Long() {
    if (num != NULL) delete[] num;
  }
  Long& operator=(Long const& right) {
    if (this == &right) return *this;
    if (num != NULL) delete[] num;
    len = right.len;
    size = right.size;
    sign = right.sign;
    num = new int[size];
    memcpy(num, right.num, sizeof(num[0]) * size);
    return *this;
  }
  Long& operator=(int init) {
    while (len > 0) num[--len] = 0;
    if (init < 0) {
      sign = 1;
      init = -init;
    } else
      sign = 0;
    do {
      num[len++] = init % 1000000000;
      init /= 1000000000;
    } while (init);
    return *this;
  }
  Long& operator=(long long init) {
    while (len > 0) num[--len] = 0;
    if (init < 0) {
      sign = 1;
      init = -init;
    } else
      sign = 0;
    do {
      num[len++] = init % 1000000000;
      init /= 1000000000;
    } while (init);
    return *this;
  }
  bool operator<(Long const& right) const {
    if (sign != right.sign) return sign == 1;
    return sign == 1 ? compare(right.num, right.len) > 0
                     : compare(right.num, right.len) < 0;
  }
  bool operator>(Long const& right) const { return right < *this; }
  bool operator>=(Long const& right) const { return !(right > *this); }
  bool operator<=(Long const& right) const { return !(right < *this); }
  bool operator!=(Long const& right) const { return !(right == *this); }
  bool operator==(Long const& right) const {
    return !((right < *this) || (*this < right));
  }
  Long operator++(int t) {
    Long res(*this);
    *this += 1;
    return res;
  }
  Long operator--(int t) {
    Long res(*this);
    *this -= 1;
    return res;
  }
  Long& operator++(void) {
    *this += 1;
    return *this;
  }
  Long& operator--(void) {
    *this -= 1;
    return *this;
  }
  Long& operator+=(long long right) {
    long long absRight = right < 0 ? -right : right;
    if (absRight < 1000000000) {
      int rsign = 0;
      if (right < 0) {
        right = -right;
        rsign = 1;
      }
      if (sign == rsign)
        intAdd((int)right);
      else {
        if (len > 1 || num[0] >= right) {
          intSub((int)right);
          if (len == 1 && num[0] == 0) sign = 0;
        } else {
          sign = rsign;
          num[0] = (int)right - num[0];
        }
      }
    } else {
      Long temp(right);
      if (sign == temp.sign)
        longAdd(*this, temp);
      else {
        if (compare(temp.num, temp.len) >= 0) {
          longSub(*this, temp);
          if (len == 1 && num[0] == 0) sign = 0;
        } else {
          sign = temp.sign;
          longSub(temp, *this);
          *this = temp;
        }
      }
    }
    return *this;
  }
  Long& operator-=(long long right) {
    this->operator+=(-right);
    return *this;
  }
  Long& operator*=(long long right) {
    if (right < 0) {
      sign = !sign;
      right = -right;
    }
    if (right < 1000000000)
      intMul(right);
    else
      longMul(*this, Long(right));
    return *this;
  }
  Long& operator/=(long long right) {
    if (right < 0) {
      sign = !sign;
      right = -right;
    }
    if (right < 1000000000)
      intDiv(right);
    else
      longDiv(*this, Long(right));
    return *this;
  }
  Long& operator%=(long long right) {
    if (right < 0) {
      sign = !sign;
      right = -right;
    }
    if (right < 1000000000)
      intMod(right);
    else
      longMod(*this, Long(right));
    return *this;
  }
  Long& operator+=(Long right) {
    if (sign == right.sign)
      longAdd(*this, right);
    else {
      if (compare(right.num, right.len) >= 0) {
        longSub(*this, right);
        if (len == 1 && num[0] == 0) sign = 0;
      } else {
        sign = right.sign;
        longSub(right, *this);
        *this = right;
      }
    }
    return *this;
  }
  Long& operator-=(Long right) {
    right.sign = !right.sign;
    this->operator+=(right);
    return *this;
  }
  Long& operator*=(Long const& right) {
    sign = sign != right.sign ? 1 : 0;
    longMul(*this, right);
    if (len == 1 && num[0] == 0) sign = 0;
    return *this;
  }
  Long& operator/=(Long const& right) {
    sign = sign != right.sign ? 1 : 0;
    longDiv(*this, right);
    if (len == 1 && num[0] == 0) sign = 0;
    return *this;
  }
  Long& operator%=(Long const& right) {
    sign = sign != right.sign ? 1 : 0;
    longMod(*this, right);
    if (len == 1 && num[0] == 0) sign = 0;
    return *this;
  }
  Long& operator^=(long long right) {
    exp(*this, right);
    return *this;
  }
  Long operator+(long long right) const {
    Long ret(*this);
    ret += right;
    return ret;
  }
  Long operator-(long long right) const {
    Long ret(*this);
    ret -= right;
    return ret;
  }
  Long operator*(long long right) const {
    Long ret(*this);
    ret *= right;
    return ret;
  }
  Long operator/(long long right) const {
    Long ret(*this);
    ret /= right;
    return ret;
  }
  Long operator%(long long right) const {
    Long ret(*this);
    ret %= right;
    return ret;
  }
  Long operator^(long long right) const {
    Long ret(*this);
    ret ^= right;
    return ret;
  }
  Long operator+(Long const& right) const {
    Long ret(*this);
    ret += right;
    return ret;
  }
  Long operator-(Long const& right) const {
    Long ret(*this);
    ret -= right;
    return ret;
  }
  Long operator*(Long const& right) const {
    Long ret(*this);
    ret *= right;
    return ret;
  }
  Long operator/(Long const& right) const {
    Long ret(*this);
    ret /= right;
    return ret;
  }
  Long operator%(Long const& right) const {
    Long ret(*this);
    ret %= right;
    return ret;
  }
  int toInt() const { return num[0]; }
  string toString() const {
    string ret;
    char buff[9 + 2];
    if (sign == 1) ret = "-";
    sprintf(buff, "%d", num[len - 1]);
    ret += buff;
    for (int i = len - 2; i >= 0; i--) {
      sprintf(buff, "%09d", num[i]);
      ret += buff;
    }
    return ret;
  }
  static Long sqrt(Long right) {
    right.sqRoot();
    return right;
  }
};
Long operator+(long long left, Long const& right) { return right + left; }
Long operator*(long long left, Long const& right) { return right * left; }
Long operator-(long long left, Long const& right) { return Long(left) - right; }
const int MAX = 1024;
long long parseLong(const char* buff) {
  long long ret = 0;
  for (int i = 0; i < (int)strlen(buff); i++) ret = ret * 10LL + buff[i] - '0';
  return ret;
}
string toString(long long num) {
  if (num == 0) return "0";
  string ret;
  while (num) ret.push_back(num % 10 + '0'), num /= 10;
  reverse(ret.begin(), ret.end());
  return ret;
}
bool check(Long candidate, Long(n)) {
  Long sum(0LL);
  while (candidate % 2 == 0) {
    candidate /= 2;
    sum += candidate;
  }
  sum += candidate * (candidate - 1) / 2;
  return (sum == n);
}
vector<long long> eval(long long n) {
  vector<long long> ret;
  for (int pwr = 0; pwr < 62; pwr++) {
    long long rem = n - (1LL << pwr);
    if (rem < 0) break;
    Long A = 1LL;
    Long B = (1LL << (pwr + 1)) - 3;
    Long C = -2LL * n;
    Long D = B * B - Long(4LL) * A * C;
    if (D < 0) continue;
    Long sD(0LL);
    Long left(0LL), right(D);
    while (left <= right) {
      Long mid = (left + right) / Long(2LL);
      if (mid * mid <= D)
        sD = mid, left = mid + 1;
      else
        right = mid - 1;
    }
    if (sD * sD != D) continue;
    Long tmp1 = (Long(0LL) - B) + sD;
    if (tmp1 > 0 && tmp1 % 2 == 0) {
      tmp1 /= 2;
      for (int i = 0; i < pwr; i++) tmp1 *= 2;
      if (check(tmp1, n)) ret.push_back(parseLong(tmp1.toString().c_str()));
    }
    Long tmp2 = (Long(0LL) - B) - sD;
    if (tmp2 > 0 && tmp2 % 2 == 0) {
      tmp2 /= 2;
      for (int i = 0; i < pwr; i++) tmp2 *= 2;
      if (check(tmp1, n)) ret.push_back(parseLong(tmp2.toString().c_str()));
    }
  }
  sort(ret.begin(), ret.end());
  ret.resize(unique(ret.begin(), ret.end()) - ret.begin());
  return ret;
}
vector<long long> dummy(long long n) {
  vector<long long> ret;
  for (long long i = 1; i <= n + 1; i++) {
    long long cur = i;
    long long sum = 0;
    while (cur % 2 == 0) {
      cur /= 2;
      sum += cur;
    }
    sum += cur * (cur - 1) / 2;
    if (sum == n) ret.push_back(i);
  }
  return ret;
}
int main(void) {
  in = stdin;
  out = stdout;
  char buff[32];
  fscanf(in, "%s", buff);
  long long n = parseLong(buff);
  vector<long long> ans;
  ans = eval(n);
  if ((int)ans.size() == 0) {
    fprintf(out, "-1\n");
  } else {
    for (int i = 0; i < (int)ans.size(); i++) {
      fprintf(out, "%s\n", toString(ans[i]).c_str());
    }
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following 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

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
FILE* in;
FILE* out;
class Long {
  friend Long operator+(long long left, Long const& right);
  friend Long operator-(long long left, Long const& right);
  friend Long operator*(long long left, Long const& right);

 private:
  int len, size, sign;
  int* num;
  void expand(void) {
    int* temp = new int[size * 2];
    memset(temp, 0, sizeof(temp[0]) * size * 2);
    memcpy(temp, num, sizeof(num[0]) * size);
    delete[] num;
    num = temp;
    size *= 2;
  }
  void normalize(void) {
    while (len > 1 && num[len - 1] == 0) len--;
  }
  int compare(const int* rnum, const int rlen) const {
    if (len != rlen) return len - rlen;
    for (int i = len - 1; i >= 0; i--)
      if (num[i] != rnum[i]) return num[i] - rnum[i];
    return 0;
  }
  void intAdd(int carry) {
    for (int i = 0; carry > 0 && i < len; i++) {
      carry += num[i];
      num[i] = carry % 1000000000;
      carry /= 1000000000;
    }
    while (carry) {
      if (len >= size) expand();
      num[len++] = carry % 1000000000;
      carry /= 1000000000;
    }
  }
  void intSub(int carry) {
    for (int i = 0; carry > 0 && i < len; i++) {
      num[i] -= carry;
      carry = 0;
      if (num[i] < 0) {
        num[i] += 1000000000;
        carry++;
      }
    }
    normalize();
  }
  void intMul(long long mul) {
    long long carry = 0;
    for (int i = 0; i < len; i++) {
      carry += mul * num[i];
      num[i] = carry % 1000000000;
      carry /= 1000000000;
    }
    while (carry) {
      if (len >= size) expand();
      num[len++] = carry % 1000000000;
      carry /= 1000000000;
    }
    normalize();
  }
  void intDiv(long long div) {
    long long carry = 0;
    for (int i = len - 1; i >= 0; i--) {
      carry = carry * 1000000000 + num[i];
      num[i] = (int)(carry / div);
      carry %= div;
    }
    normalize();
  }
  void intMod(long long mod) {
    long long carry = 0;
    for (int i = len - 1; i >= 0; i--) {
      carry = carry * 1000000000 + num[i];
      carry %= mod;
      num[i] = 0;
    }
    len = 1;
    num[0] = (int)carry;
  }
  void longAdd(Long& a, Long const& b) {
    int carry = 0, idx = 0;
    while (a.size < b.len) a.expand();
    for (int i = 0; i < b.len; i++) {
      carry += a.num[idx] + b.num[idx];
      a.num[idx++] = carry % 1000000000;
      carry /= 1000000000;
    }
    while (carry) {
      if (a.size <= idx) a.expand();
      carry += a.num[idx];
      a.num[idx++] = carry % 1000000000;
      carry /= 1000000000;
    }
    a.len = max(a.len, idx);
  }
  void longSub(Long& a, Long const& b) {
    int carry = 0;
    for (int i = 0; i < a.len; i++) {
      if (i < b.len)
        carry += b.num[i];
      else if (!carry)
        break;
      a.num[i] -= carry;
      carry = a.num[i] < 0 ? 1 : 0;
      a.num[i] += carry * 1000000000;
    }
    a.normalize();
  }
  void longMul(Long& a, Long const& b) {
    Long res, temp;
    for (int i = 0; i < b.len; i++) {
      temp = a;
      temp.intMul(b.num[i]);
      temp.len += i;
      while (temp.size < temp.len) temp.expand();
      for (int c = temp.len - 1; c >= i; c--) temp.num[c] = temp.num[c - i];
      for (int c = 0; c < i; c++) temp.num[c] = 0;
      longAdd(res, temp);
    }
    res.normalize();
    res.sign = a.sign;
    a = res;
  }
  void longDiv(Long& a, Long const& b) {
    Long leftLim, rightLim;
    rightLim.len = max(a.len - b.len + 1, 1);
    while (rightLim.size < rightLim.len) rightLim.expand();
    rightLim.num[rightLim.len - 1] = 1000000000 - 1;
    Long res, mid;
    while (leftLim <= rightLim) {
      mid = leftLim + rightLim;
      mid.intDiv(2);
      if (b * mid <= a) {
        if (res < mid) res = mid;
        leftLim = ++mid;
      } else
        rightLim = --mid;
    }
    res.sign = a.sign;
    a = res;
  }
  void longMod(Long& a, Long const& b) {
    Long temp(a);
    longDiv(temp, b);
    longMul(temp, b);
    longSub(a, temp);
  }
  void exp(Long& a, long long power) {
    Long mul(a);
    a = 1;
    while (power) {
      if (power & 1) a *= mul;
      mul *= mul;
      power >>= 1;
    }
  }
  void sqRoot() {
    Long leftLim, rightLim(*this);
    Long mid, res;
    while (leftLim <= rightLim) {
      mid = leftLim + rightLim;
      mid.intDiv(2);
      if (mid * mid <= *this) {
        if (res < mid) res = mid;
        leftLim = ++mid;
      } else
        rightLim = --mid;
    }
    res.sign = sign;
    *this = res;
  }

 public:
  Long() {
    size = 4;
    sign = 0;
    num = new int[size];
    len = 1;
    memset(num, 0, sizeof(num[0]) * size);
  }
  Long(long long init) {
    size = 4;
    num = new int[size];
    len = 0;
    memset(num, 0, sizeof(num[0]) * size);
    sign = init < 0 ? 1 : 0;
    init = init < 0 ? -init : init;
    do {
      num[len++] = init % 1000000000;
      init /= 1000000000;
    } while (init);
  }
  Long(string str) {
    sign = 0;
    if (str[0] == '-') {
      sign = 1;
      str = str.substr(1);
    }
    size = max(4, (int)str.size() / 9 + 1);
    num = new int[size];
    len = 0;
    memset(num, 0, sizeof(num[0]) * size);
    for (int start = (int)str.size() - 1; start >= 0; start -= 9) {
      num[len] = 0;
      for (int i = min(start, 9 - 1); i >= 0; i--)
        num[len] = num[len] * 10 + str[start - i] - 48;
      len++;
    }
    normalize();
  }
  Long(Long const& right) {
    len = right.len;
    size = right.size;
    sign = right.sign;
    num = new int[size];
    memcpy(num, right.num, sizeof(num[0]) * size);
  }
  ~Long() {
    if (num != NULL) delete[] num;
  }
  Long& operator=(Long const& right) {
    if (this == &right) return *this;
    if (num != NULL) delete[] num;
    len = right.len;
    size = right.size;
    sign = right.sign;
    num = new int[size];
    memcpy(num, right.num, sizeof(num[0]) * size);
    return *this;
  }
  Long& operator=(int init) {
    while (len > 0) num[--len] = 0;
    if (init < 0) {
      sign = 1;
      init = -init;
    } else
      sign = 0;
    do {
      num[len++] = init % 1000000000;
      init /= 1000000000;
    } while (init);
    return *this;
  }
  Long& operator=(long long init) {
    while (len > 0) num[--len] = 0;
    if (init < 0) {
      sign = 1;
      init = -init;
    } else
      sign = 0;
    do {
      num[len++] = init % 1000000000;
      init /= 1000000000;
    } while (init);
    return *this;
  }
  bool operator<(Long const& right) const {
    if (sign != right.sign) return sign == 1;
    return sign == 1 ? compare(right.num, right.len) > 0
                     : compare(right.num, right.len) < 0;
  }
  bool operator>(Long const& right) const { return right < *this; }
  bool operator>=(Long const& right) const { return !(right > *this); }
  bool operator<=(Long const& right) const { return !(right < *this); }
  bool operator!=(Long const& right) const { return !(right == *this); }
  bool operator==(Long const& right) const {
    return !((right < *this) || (*this < right));
  }
  Long operator++(int t) {
    Long res(*this);
    *this += 1;
    return res;
  }
  Long operator--(int t) {
    Long res(*this);
    *this -= 1;
    return res;
  }
  Long& operator++(void) {
    *this += 1;
    return *this;
  }
  Long& operator--(void) {
    *this -= 1;
    return *this;
  }
  Long& operator+=(long long right) {
    long long absRight = right < 0 ? -right : right;
    if (absRight < 1000000000) {
      int rsign = 0;
      if (right < 0) {
        right = -right;
        rsign = 1;
      }
      if (sign == rsign)
        intAdd((int)right);
      else {
        if (len > 1 || num[0] >= right) {
          intSub((int)right);
          if (len == 1 && num[0] == 0) sign = 0;
        } else {
          sign = rsign;
          num[0] = (int)right - num[0];
        }
      }
    } else {
      Long temp(right);
      if (sign == temp.sign)
        longAdd(*this, temp);
      else {
        if (compare(temp.num, temp.len) >= 0) {
          longSub(*this, temp);
          if (len == 1 && num[0] == 0) sign = 0;
        } else {
          sign = temp.sign;
          longSub(temp, *this);
          *this = temp;
        }
      }
    }
    return *this;
  }
  Long& operator-=(long long right) {
    this->operator+=(-right);
    return *this;
  }
  Long& operator*=(long long right) {
    if (right < 0) {
      sign = !sign;
      right = -right;
    }
    if (right < 1000000000)
      intMul(right);
    else
      longMul(*this, Long(right));
    return *this;
  }
  Long& operator/=(long long right) {
    if (right < 0) {
      sign = !sign;
      right = -right;
    }
    if (right < 1000000000)
      intDiv(right);
    else
      longDiv(*this, Long(right));
    return *this;
  }
  Long& operator%=(long long right) {
    if (right < 0) {
      sign = !sign;
      right = -right;
    }
    if (right < 1000000000)
      intMod(right);
    else
      longMod(*this, Long(right));
    return *this;
  }
  Long& operator+=(Long right) {
    if (sign == right.sign)
      longAdd(*this, right);
    else {
      if (compare(right.num, right.len) >= 0) {
        longSub(*this, right);
        if (len == 1 && num[0] == 0) sign = 0;
      } else {
        sign = right.sign;
        longSub(right, *this);
        *this = right;
      }
    }
    return *this;
  }
  Long& operator-=(Long right) {
    right.sign = !right.sign;
    this->operator+=(right);
    return *this;
  }
  Long& operator*=(Long const& right) {
    sign = sign != right.sign ? 1 : 0;
    longMul(*this, right);
    if (len == 1 && num[0] == 0) sign = 0;
    return *this;
  }
  Long& operator/=(Long const& right) {
    sign = sign != right.sign ? 1 : 0;
    longDiv(*this, right);
    if (len == 1 && num[0] == 0) sign = 0;
    return *this;
  }
  Long& operator%=(Long const& right) {
    sign = sign != right.sign ? 1 : 0;
    longMod(*this, right);
    if (len == 1 && num[0] == 0) sign = 0;
    return *this;
  }
  Long& operator^=(long long right) {
    exp(*this, right);
    return *this;
  }
  Long operator+(long long right) const {
    Long ret(*this);
    ret += right;
    return ret;
  }
  Long operator-(long long right) const {
    Long ret(*this);
    ret -= right;
    return ret;
  }
  Long operator*(long long right) const {
    Long ret(*this);
    ret *= right;
    return ret;
  }
  Long operator/(long long right) const {
    Long ret(*this);
    ret /= right;
    return ret;
  }
  Long operator%(long long right) const {
    Long ret(*this);
    ret %= right;
    return ret;
  }
  Long operator^(long long right) const {
    Long ret(*this);
    ret ^= right;
    return ret;
  }
  Long operator+(Long const& right) const {
    Long ret(*this);
    ret += right;
    return ret;
  }
  Long operator-(Long const& right) const {
    Long ret(*this);
    ret -= right;
    return ret;
  }
  Long operator*(Long const& right) const {
    Long ret(*this);
    ret *= right;
    return ret;
  }
  Long operator/(Long const& right) const {
    Long ret(*this);
    ret /= right;
    return ret;
  }
  Long operator%(Long const& right) const {
    Long ret(*this);
    ret %= right;
    return ret;
  }
  int toInt() const { return num[0]; }
  string toString() const {
    string ret;
    char buff[9 + 2];
    if (sign == 1) ret = "-";
    sprintf(buff, "%d", num[len - 1]);
    ret += buff;
    for (int i = len - 2; i >= 0; i--) {
      sprintf(buff, "%09d", num[i]);
      ret += buff;
    }
    return ret;
  }
  static Long sqrt(Long right) {
    right.sqRoot();
    return right;
  }
};
Long operator+(long long left, Long const& right) { return right + left; }
Long operator*(long long left, Long const& right) { return right * left; }
Long operator-(long long left, Long const& right) { return Long(left) - right; }
const int MAX = 1024;
long long parseLong(const char* buff) {
  long long ret = 0;
  for (int i = 0; i < (int)strlen(buff); i++) ret = ret * 10LL + buff[i] - '0';
  return ret;
}
string toString(long long num) {
  if (num == 0) return "0";
  string ret;
  while (num) ret.push_back(num % 10 + '0'), num /= 10;
  reverse(ret.begin(), ret.end());
  return ret;
}
bool check(Long candidate, Long(n)) {
  Long sum(0LL);
  while (candidate % 2 == 0) {
    candidate /= 2;
    sum += candidate;
  }
  sum += candidate * (candidate - 1) / 2;
  return (sum == n);
}
vector<long long> eval(long long n) {
  vector<long long> ret;
  for (int pwr = 0; pwr < 62; pwr++) {
    long long rem = n - (1LL << pwr);
    if (rem < 0) break;
    Long A = 1LL;
    Long B = (1LL << (pwr + 1)) - 3;
    Long C = -2LL * n;
    Long D = B * B - Long(4LL) * A * C;
    if (D < 0) continue;
    Long sD(0LL);
    Long left(0LL), right(D);
    while (left <= right) {
      Long mid = (left + right) / Long(2LL);
      if (mid * mid <= D)
        sD = mid, left = mid + 1;
      else
        right = mid - 1;
    }
    if (sD * sD != D) continue;
    Long tmp1 = (Long(0LL) - B) + sD;
    if (tmp1 > 0 && tmp1 % 2 == 0) {
      tmp1 /= 2;
      for (int i = 0; i < pwr; i++) tmp1 *= 2;
      if (check(tmp1, n)) ret.push_back(parseLong(tmp1.toString().c_str()));
    }
    Long tmp2 = (Long(0LL) - B) - sD;
    if (tmp2 > 0 && tmp2 % 2 == 0) {
      tmp2 /= 2;
      for (int i = 0; i < pwr; i++) tmp2 *= 2;
      if (check(tmp1, n)) ret.push_back(parseLong(tmp2.toString().c_str()));
    }
  }
  sort(ret.begin(), ret.end());
  ret.resize(unique(ret.begin(), ret.end()) - ret.begin());
  return ret;
}
vector<long long> dummy(long long n) {
  vector<long long> ret;
  for (long long i = 1; i <= n + 1; i++) {
    long long cur = i;
    long long sum = 0;
    while (cur % 2 == 0) {
      cur /= 2;
      sum += cur;
    }
    sum += cur * (cur - 1) / 2;
    if (sum == n) ret.push_back(i);
  }
  return ret;
}
int main(void) {
  in = stdin;
  out = stdout;
  char buff[32];
  fscanf(in, "%s", buff);
  long long n = parseLong(buff);
  vector<long long> ans;
  ans = eval(n);
  if ((int)ans.size() == 0) {
    fprintf(out, "-1\n");
  } else {
    for (int i = 0; i < (int)ans.size(); i++) {
      fprintf(out, "%s\n", toString(ans[i]).c_str());
    }
  }
  return 0;
}

```