//#pragma comment(linker, "/STACK:20000000")
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <ctime>

#ifndef GATILOV_INTEGER_LONG_ARITHMETICS_192768
#define GATILOV_INTEGER_LONG_ARITHMETICS_192768

#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#undef min
#undef max

#define USE_INT64

class LongInteger {
public:
    typedef LongInteger Lint;
#ifdef USE_INT64
	typedef long long int64;
	static const int DIGITS = 9;
	static const int BASE = 1000000000;
#else
	typedef int int64;
	static const int DIGITS = 4;
	static const int BASE = 10000;
#endif

	char sign;			// (-1 / 0 / 1)
	std::vector<int> arr;

    inline const int &operator[] (int ind) const { return arr[ind]; }
	inline int &operator[] (int ind) { return arr[ind]; }

	inline void CutTrailingZeros();
	inline int UnsignedCompare(const Lint &other) const;
	inline void UnsignedAdd(const Lint &base, const Lint &other);
	inline void UnsignedSub(const Lint &base, const Lint &other);
	inline void AddSub(const Lint &other, char othersign);

	inline void ShiftSub(const Lint &other, int shift);
	inline bool ShiftNotLess(const Lint &other, int shift) const;
	inline double GetDoubleApprox(int level) const;

	inline void PureMultDigit(const Lint &base, int digit);
	inline int PureDivideDigit(const Lint &base, int digit);

	template<class T> inline const T DullConverter() const;
	template<class T> inline void DullConstructor(T x);
	static int ScanDigit(const char *s, const char *t);

public:
	inline LongInteger() : sign(0), arr() {}
	inline LongInteger(const LongInteger &x) : sign(x.sign), arr(x.arr) {}
	inline LongInteger &operator= (const Lint &x) { sign = x.sign;  arr = x.arr;  return *this; }
	inline operator int() const { return DullConverter<int>(); }
	inline operator long long() const { return DullConverter<long long>(); }
	inline operator double() const { return DullConverter<double>(); }
	inline LongInteger(int x) { DullConstructor<int>(x); }
	inline LongInteger(long long x) { DullConstructor<long long>(x); }

	inline int Compare(const Lint &other) const;
	inline const Lint operator<< (int digs) const;
	inline const Lint operator>> (int digs) const;
	inline Lint &operator+= (const Lint &other) { AddSub(other,  other.sign);  return *this; }
	inline Lint &operator-= (const Lint &other) { AddSub(other, -other.sign);  return *this; }
	inline void operator++ () { *this += 1; }
	inline void operator-- () { *this -= 1; }
	inline void operator++ (int) { *this += 1; }
	inline void operator-- (int) { *this -= 1; }
	inline void Divide(const Lint &other, Lint &div, Lint &rem) const;
	inline const Lint operator* (const Lint &other) const;
	inline const Lint operator/ (const Lint &other) const { Lint div, rem;  Divide(other, div, rem);  return div; }
	inline const Lint operator% (const Lint &other) const { Lint div, rem;  Divide(other, div, rem);  return rem; }
	inline Lint &operator*= (int other);
	inline Lint &operator/= (int other);
	inline int operator% (int other) const;
	inline Lint SquareRoot() const;

	inline int GetSign() const { return sign; }
	inline Lint &Negate() { sign = -sign;   return *this; }
	inline Lint &Absolute() { if (sign < 0) sign = -sign;  return *this; }
	inline const Lint operator- () const { return Lint(*this).Negate(); }

	inline bool operator< (const Lint &other) const { return Compare(other) < 0; }
	inline bool operator> (const Lint &other) const { return Compare(other) > 0; }
	inline bool operator== (const Lint &other) const { return Compare(other) == 0; }
	inline bool operator<= (const Lint &other) const { return Compare(other) <= 0; }
	inline bool operator>= (const Lint &other) const { return Compare(other) >= 0; }
	inline bool operator!= (const Lint &other) const { return Compare(other) != 0; }
	inline Lint &operator<<= (int digs) { *this = *this << digs;  return *this; }
	inline Lint &operator>>= (int digs) { *this = *this >> digs;  return *this; }
	inline const Lint operator+ (const Lint &other) const { return Lint(*this) += other; }
	inline const Lint operator- (const Lint &other) const { return Lint(*this) -= other; }
	inline Lint &operator*= (const Lint &other) { *this = *this * other;  return *this; }
	inline Lint &operator/= (const Lint &other) { *this = *this / other;  return *this; }
	inline Lint &operator%= (const Lint &other) { *this = *this % other;  return *this; }
	inline const Lint operator* (int other) const { return Lint(*this) *= other; }
	inline const Lint operator/ (int other) const { return Lint(*this) /= other; }
	inline Lint &operator%= (int other) { *this = *this % other;  return *this; }

	inline operator std::string() const;
	inline LongInteger(const std::string &s);
	inline void Print(FILE *f = stdout) const;
	inline void Scan(FILE *f = stdin);
//	friend inline void swap(LongInteger &a, LongInteger &b);
};

namespace std {
	inline const LongInteger abs(const LongInteger &f) {
		return LongInteger(f).Absolute();
	}
	inline void swap(LongInteger &a, LongInteger &b) {
		std::swap(a.sign, b.sign);
		std::swap(a.arr, b.arr);
	}
};

//Implementation
inline const LongInteger LongInteger::operator<< (int digs) const {
	assert(digs >= 0);
	if (sign == 0) return Lint();
	Lint res;
	res.sign = sign;
	res.arr.resize(arr.size() + digs);
	int i;
	for (i = res.arr.size()-1; i-digs>=0; i--) res.arr[i] = arr[i-digs];
	for (; i>=0; i--) res.arr[i] = 0;
	return res;
}

inline const LongInteger LongInteger::operator>> (int digs) const {
	assert(digs >= 0);
	if (sign == 0 || arr.size() < digs) return Lint();
	Lint res;
	res.sign = sign;
	res.arr.resize(arr.size() - digs);
	int i;
	for (i = 0; i<res.arr.size(); i++) res.arr[i] = arr[i+digs];
	return res;
}

inline void LongInteger::CutTrailingZeros() {
	while (arr.size() && !arr.back()) arr.pop_back();
	if (arr.empty()) sign = 0;
}

inline int LongInteger::UnsignedCompare(const Lint &other) const {
	if (arr.size() != other.arr.size()) return (arr.size() < other.arr.size() ? -1 : 1);
	for (int i = arr.size()-1; i>=0; i--)
		if (arr[i] != other[i])
			return (arr[i] < other[i] ? -1 : 1);
	return 0;
}

inline void LongInteger::UnsignedAdd(const Lint &base, const Lint &other) {
	int buff = 0;
	int sz = std::max(base.arr.size(), other.arr.size());
	arr.resize(sz);
	for (int i = 0; i<sz; i++) {
		arr[i] = (i<base.arr.size() ? base[i] : 0) + (i<other.arr.size() ? other[i] : 0) + buff;
		if (arr[i] >= BASE) {
			arr[i] -= BASE;
			buff = 1;
		}
		else buff = 0;
	}
	if (buff) arr.push_back(buff);
}

inline void LongInteger::UnsignedSub(const Lint &base, const Lint &other) {
	int buff = 0;
	assert(base.arr.size() >= other.arr.size());
	int sz = base.arr.size();
	arr.resize(sz);
	for (int i = 0; i<sz; i++) {
		arr[i] = base[i] - (i<other.arr.size() ? other[i] : 0) - buff;
		if (arr[i] < 0) {
			arr[i] += BASE;
			buff = 1;
		}
		else buff = 0;
	}
	assert(!buff);
	CutTrailingZeros();
}

inline void LongInteger::AddSub(const Lint &other, char othersign) {
	if (othersign == 0) return;
	if (sign == 0) {
		*this = other;
		sign = othersign;
		return;
	}
	if (sign == othersign) {
		UnsignedAdd(*this, other);
		return;
	}
	int t = UnsignedCompare(other);
	if (t==0) { *this = 0;  arr.clear(); }
	else {
		if (t>0) UnsignedSub(*this, other);
		else {
			UnsignedSub(other, *this);
			sign = othersign;
		}
	}
}

inline void LongInteger::PureMultDigit(const Lint &base, int digit) {
	int64 buff = 0;
	int sz = base.arr.size();
	arr.resize(sz + 1);
	for (int i = 0; i<sz; i++) {
		buff += int64(base[i]) * digit;
		arr[i] = buff % BASE;
		buff /= BASE;
	}
	arr[sz] = buff;
	CutTrailingZeros();
}

inline int LongInteger::PureDivideDigit(const Lint &base, int digit) {
	assert(digit);
	int64 buff = 0;
	arr.resize(base.arr.size());
	for (int i = base.arr.size()-1; i>=0; i--) {
		buff *= BASE;
		buff += base[i];
		arr[i] = buff / digit;
		buff %= digit;
	}
	CutTrailingZeros();
	return buff;
}

inline LongInteger &LongInteger::operator*= (int other) {
	int sgn = (other ? (other<0 ? -1 : 1) : 0);
	sign *= sgn;
	if (sign == 0) return *this;
	other *= sgn;
	if (other < BASE) PureMultDigit(*this, other);
	else *this *= Lint(other);
	return *this;
}

inline LongInteger &LongInteger::operator/= (int other) {
	int sgn = (other ? (other<0 ? -1 : 1) : 0);
	assert(sgn);
	sign *= sgn;
	if (sign == 0) return *this;
	other *= sgn;
	if (other < BASE) PureDivideDigit(*this, other);
	else *this /= Lint(other);
	return *this;
}

inline int LongInteger::operator% (int other) const {
	int sgn = (other ? (other<0 ? -1 : 1) : 0);
	assert(sgn);
	if (sign == 0) return 0;
	other *= sgn;
	if (other < BASE) {
		Lint temp;
		return sign * temp.PureDivideDigit(*this, other);
	}
	else {
		other *= sgn;
		return *this % Lint(other);
	}
}

inline const LongInteger LongInteger::operator* (const Lint &other) const {
	static const int TIMES = 9;
	Lint res;
	res.sign = sign * other.sign;
	if (res.sign == 0) return res;

	int tsz = arr.size();
	int osz = other.arr.size();
	int rsz = tsz + osz;
	res.arr.resize(rsz);

	int64 buff, mega;
	mega = 0;
	for (int i = 0; i<rsz; i++) {
		int cnt = 0;
		buff = mega;
		mega = 0;
		for (int j = std::max(0, i-osz+1); j<=std::min(i, tsz-1); j++) {
			buff += int64(arr[j]) * other[i-j];
			if ((++cnt) == TIMES) {
				mega += buff / BASE;
				buff %= BASE;
				cnt = 0;
			}
		}
		mega += buff / BASE;
		res.arr[i] = buff % BASE;
	}
	assert(mega == 0);
	res.CutTrailingZeros();
	return res;
}

inline bool LongInteger::ShiftNotLess(const Lint &other, int shift) const {
	if (arr.size() != other.arr.size() + shift) return (arr.size() >= other.arr.size() + shift);
	for (int i = arr.size()-1; i>=shift; i--)
		if (arr[i] != other[i-shift])
			return arr[i] >= other[i-shift];
	return true;
}
inline void LongInteger::ShiftSub(const Lint &other, int shift) {
	int buff = 0;
	assert(other.sign == 0 || arr.size() >= other.arr.size() + shift);
	int sz = arr.size();
	for (int i = shift; i<sz; i++) {
		arr[i] -= (i-shift < other.arr.size() ? other[i-shift] : 0) + buff;
		if (arr[i] < 0) {
			arr[i] += BASE;
			buff = 1;
		}
		else buff = 0;
	}
	assert(!buff);
	CutTrailingZeros();
}
/*inline void LongInteger::Divide(const Lint &other, Lint &div, Lint &rem) const {		//variant with binary search
	assert(other.sign);
	int tsz = arr.size();
	int osz = other.arr.size();
	if (sign == 0 || tsz < osz) {
		div = Lint();	//zero
		rem = *this;
		return;
	}

	div.arr.resize(tsz - osz + 1);
	Lint ost = *this;
	for (int i = tsz - osz; i>=0; i--) {
		int left = 0;
		int right = BASE;
		int middle;
		Lint tmult;
		while (right - left > 1) {
			middle = (left + right) >> 1;
			Lint tmult;
			tmult.PureMultDigit(other, middle);
			if (ost.ShiftNotLess(tmult, i)) left = middle;
			else right = middle;
		}
		div[i] = left;
		tmult.PureMultDigit(other, left);
		ost.ShiftSub(tmult, i);
	}
	rem = ost;

	div.sign = sign * other.sign;
	rem.sign = sign;
	div.CutTrailingZeros();
	rem.CutTrailingZeros();
}*/
inline double LongInteger::GetDoubleApprox(int level) const {
	double res = 0.0;
	for (int j = arr.size() - 1; j>=level; j--) {
		res *= BASE;
		if (j >= 0) res += arr[j];
	}
	return res;
}
inline void LongInteger::Divide(const Lint &other, Lint &div, Lint &rem) const {
	static const double EPS = std::max(3.0 / BASE, 1e-15 * BASE);
	assert(other.sign);
	int tsz = arr.size();
	int osz = other.arr.size();
	if (sign == 0 || tsz < osz) {
		div = Lint();	//zero
		rem = *this;
		return;
	}

	div.arr.resize(tsz - osz + 1);
	Lint ost = *this;
	double dother = other.GetDoubleApprox(osz - 3);
	for (int i = tsz - osz; i>=0; i--) {
		double dcurr = ost.GetDoubleApprox(i + osz - 3) / dother;
		int curr = int(dcurr);
		double diff = dcurr - curr;

		bool canbeless = (diff<EPS && curr>0);
		bool canbegreater = (diff>1.0-EPS && curr<BASE-1);

		Lint tmult;
		tmult.sign = 1;
		if (canbegreater) curr++;
		tmult.PureMultDigit(other, curr);
		if ((canbegreater || canbeless) && !ost.ShiftNotLess(tmult, i)) {
			curr--;
			tmult.UnsignedSub(tmult, other);
		}
		div[i] = curr;
		ost.ShiftSub(tmult, i);
	}
	rem = ost;

	div.sign = sign * other.sign;
	rem.sign = sign;
	div.CutTrailingZeros();
	rem.CutTrailingZeros();
}

inline LongInteger LongInteger::SquareRoot() const {
	static const int LOGBASE2 = int(log(double(BASE))/log(2.0) / 2) + 1;
	assert(sign >= 0);
	if (sign == 0) return Lint();
	Lint left, right, middle;
	Lint lsqr, rsqr, msqr, prod;
	int power = arr.size() + 1;
	right = 1;
	for (int i = 0; i<power; i++) right *= (1<<LOGBASE2);
	rsqr = right*right;
	while (right - left > Lint(1)) {
		middle = (left + right) / 2;
		msqr = (lsqr + prod + rsqr) / 4;
		if (*this < msqr) {
			right = middle;
			rsqr = msqr;
			prod /= 2;
			prod += lsqr;
		}
		else {
			left = middle;
			lsqr = msqr;
			prod /= 2;
			prod += rsqr;
		}
	}
	return left;
}

inline int LongInteger::Compare(const Lint &other) const {
	if (sign != other.sign) return (sign < other.sign ? -1 : 1);
	if (sign == 0) return 0;
	return sign * UnsignedCompare(other);
}

template<class T> inline const T LongInteger::DullConverter() const {
	T res = 0;
	if (sign == 0) return res;
	for (int i = arr.size()-1; i>=0; i--) {
		res *= BASE;
		res += arr[i];
	}
	return res * sign;
}

template<class T> inline void LongInteger::DullConstructor(T x) {
	if (x == T(0)) { sign = 0;  return; }
	if (x < T(0)) {
		sign = -1;
		x = -x;
	}
	else sign = 1;

	if (x < T(BASE)) arr.push_back(x);
	else {
		while (x != T(0)) {
			arr.push_back(x % BASE);
			x /= BASE;
		}
	}
}

inline LongInteger::operator std::string() const {
	if (sign == 0) return "0";
	std::string res;
	char buff[32];
	if (sign < 0) res += "-";
    sprintf(buff, "%d", arr.back());
    res += buff;

    char mask[] = "%00d";  mask[2] += DIGITS;
    for (int i = arr.size() - 2; i>=0; i--) {
		sprintf(buff, mask, arr[i]);
		res += buff;
    }
    return res;
}

int LongInteger::ScanDigit(const char *s, const char *t) {
	int l = t-s;
	int res = 0;
	for (int i = 0; i<l; i++) {
		res *= 10;
		res += (s[i]-'0');
	}
	return res;
}
inline LongInteger::LongInteger(const std::string &s) {
	const char *str = s.c_str();
	int curr = 0;
	if (str[curr] == '-') {
		sign = -1;
		curr++;
	}
	else sign = 1;

	int digits = (s.size() - curr - 1) / DIGITS;
	int first = (s.size() - curr - 1) % DIGITS + 1;
	arr.resize(digits + 1);
	arr[digits] = ScanDigit(str + curr, str + curr+first);
	curr += first;
	for (int i = digits-1; i>=0; i--) {
		arr[i] = ScanDigit(str + curr, str + curr + DIGITS);
		curr += DIGITS;
	}
	assert(curr == s.size());
	CutTrailingZeros();
}

inline void LongInteger::Print(FILE *f) const {
	std::string s = std::string(*this);
	fprintf(f, "%s\n", s.c_str());
}

inline void LongInteger::Scan(FILE *f) {
	std::string str;
	fscanf(f, " ");
	int curr;
	while (1) {
		curr = fgetc(f);
		if (curr == EOF) break;
		if (isspace(curr)) {
			ungetc(curr, f);
			break;
		}
		str += curr;
	}
	*this = Lint(str);
}

#endif

using namespace std;
typedef long long int64;
#ifdef HOME
	#define E(c) cerr<<#c
	#define Eo(x) cerr<<#x<<" = "<<(x)<<endl
	#define Ef(...) fprintf(stderr, __VA_ARGS__)
#else
	#define E(c) ((void)0)
	#define Eo(x) ((void)0)
	#define Ef(...) ((void)0)
#endif

LongInteger n;
set<LongInteger> ans;

void TryAnswer(int s, LongInteger m) {
	if (m < LongInteger(1)) return;
	LongInteger res = (m * (m - LongInteger(1))/2) + m * LongInteger((1LL<<s) - 1);
	if (res != n) return;
	ans.insert(LongInteger(1LL<<s) * m);
}

int main() {
#ifdef HOME
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int64 n64;
	scanf("%I64d", &n64);
	n = n64;

	for (int s = 0; s<=61; s++) {
		LongInteger qb = (1LL<<(s+1)) - 3;
		LongInteger qc = n * (-2);
		LongInteger qd = qb*qb - qc*4;
		if (qd < LongInteger(0))
			continue;
		qd = qd.SquareRoot();
		TryAnswer(s, (-qb + qd) / 2);
		TryAnswer(s, (-qb - qd) / 2);
	}

	if (ans.empty()) printf("-1\n");
	else {
		for (auto it = ans.begin(); it != ans.end(); it++)
			printf("%s\n", string(*it).c_str());
	}

	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

const int MAXLEN=20;
long long buf[MAXLEN];
struct very_long
{
    static const long long base=1e9;
    int len;
    long long digits[MAXLEN];
    very_long() {}
    very_long(long long x)
    {
        if(x==0)
        {
            digits[0]=0;
            len=1;
        }
        else
        {
            int i;
            for(i=0; x; ++i)
            {
                digits[i]=x%base;
                x/=base;
            }
            len=i;
        }
    }
    very_long& operator *=(const very_long& mul)
    {
        int i, j;
        memset(buf, 0, sizeof(buf));
        long long peren;
        for(i=0; i<len; ++i)
        {
            for(j=peren=0; j<mul.len; ++j)
            {
                buf[i+j] += (digits[i]*mul.digits[j]+peren);
                peren = buf[i+j]/base;
                buf[i+j] -= peren*base;
            }
            for(; peren; ++j)
            {
                buf[i+j]+=peren;
                peren = buf[i+j]/base;
                buf[i+j] -= peren*base;
            }
        }
        memcpy(digits, buf, sizeof(buf));
        for(i=MAXLEN-1; i && !digits[i]; --i);
        len=i+1;
        return *this;
    }
    void print()
    {
        int i;
        printf("%I64d", digits[len-1]);
        for(i=len-2; i>=0; --i)
            printf("%09I64d", digits[i]);
    }
};
long long ans[100];
int cnt;
int order[100];
const double EPS=1e-5;

/*
bool cmp(int a, int b)
{
    very_long &va=ans[a], vb=ans[b];
    if(va.len<vb.len)
        return true;
    if(va.len>vb.len)
        return false;
    int i;
    for(i=va.len-1; i>=0; --i)
    {
        if(va.digits[i]<vb.digits[i])
            return true;
        if(va.digits[i]>vb.digits[i])
            return false;
    }
    return false;
}
*/

int main()
{
    long long n;
    int k;
    long long r, t;

    scanf("%I64d", &n);
    cnt=0;
    for(k=0;; ++k)
    {
        r=(1LL<<(k+1))-3;
        t = 0.5*(-r+sqrt((double)(r)*r+8.0*n))+EPS;
        for(; t*(t+r)<2*n; ++t);
        for(; t*(t+r)>2*n; --t);
        if(t==0)
            break;
        if(t*(t+r)==2*n && (t&1))
            ans[cnt++]=t*(1LL<<k);
    }
    if(cnt==0)
    {
        printf("-1\n");
        return 0;
    }
    sort(ans, ans+cnt);
    for(k=0; k<cnt; ++k)
        printf("%I64d\n", ans[k]);
    return 0;
}


#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x > y ? y : x)
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	long long n;
	cin>>n;
	long long k=0;
	vector<long long> res(0);
	long long st2=1;
	while(true)
	{
		long long l=1;
		long long r=1;
		while(r*r+(2*st2-3)*r<2*n)r*=2;
		while(l<r)
		{
			long long m=(l+r)/2;
			if(m*m+(2*st2-3)*m<2*n)l=m+1;
			else r=m;
		}
		if(r*r+(2*st2-3)*r==2*n && r%2)res.push_back(st2*r);
		st2*=2;
		if(st2>n+5)break;
	}
	sort(res.begin(),res.end());
	for(int i=0;i<res.size();i++)
		if(!(i && res[i]==res[i-1]))cout<<res[i]<<endl;
	if(res.size() == 0)cout<<"-1"<<endl;
	return 0;
}


#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <stack>

using namespace std;

void solve()
{
	long long n;
	cin >> n;
	vector<long long> res;
	for( long long cur = 1; cur <= 2 * n; cur = cur * 2 ) {
		long long min = 0;
		long long max = n / cur + 1;
		if( max > 1000000000 ) max = 1000000000;
		while( max - min > 1 ) {
			long long med = (max + min) / 2;
			med = med * 2 + 1;
			long long total = med * (med - 1) / 2 + med * (cur - 1);
			if( total > n ) {
				max = med / 2;
			} else {
				min = med / 2;
			}
		}
		min = min * 2 + 1;
		long long total = min * (min - 1) / 2 + min * (cur - 1);
		if( total == n ) {
			res.push_back( cur * min );
		}
		max = max * 2 + 1;
		total = max * (max - 1) / 2 + max * (cur - 1);
		if( total == n ) {
			res.push_back( cur * max );
		}
	}
	sort( res.begin(), res.end() );
	for( int i = 0; i < res.size(); i++ ) {
		cout << res[i] << endl;
	}
	if( res.size() == 0 ) {
		cout << -1 << endl;
	}
}

int main() {
	solve();
	return 0;
}


#include <iostream>
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <algorithm>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define inf 2000000000LL
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define For(i,s,n) for (ll i=s;i<=n;i++)
#define FOR(i,s,n) for (int i=s;i<n;i++)
#define Ford(i,s,n) for (int i=s;i>=n;i--)
#pragma comment(linker, "/STACK:16777216")

#define eps 0.0000001

#define MD 1000000007

typedef long long ll;

using namespace std;

vector <ll> ans;
ll n;

int main(){
	scanf("%I64d",&n);
	For(i,0,63){
		if (((1LL)<<i)>n) break;
		ll L=1,R=(n+1)/((1LL)<<i);
		while(R>=L){
			ll MID=(L+R)/2,S=0;
			FOR(j,0,i)
				S+=((1LL<<j)*MID);
			S+=((MID*(MID-1))/2);
			if (S==n) {ans.pb(MID*(1LL<<i));break;}
			if (S>n) R=MID-1;else L=MID+1;
		}
	}
	sort(ans.begin(),ans.end());
	if (!ans.size()) puts("-1");else
		FOR(i,0,ans.size()) printf("%I64d\n",ans[i]);
	//system("pause");
}


#include <iostream>
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <algorithm>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define inf 2000000000LL
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define For(i,s,n) for (ll i=s;i<=n;i++)
#define FOR(i,s,n) for (int i=s;i<n;i++)
#define Ford(i,s,n) for (int i=s;i>=n;i--)
#pragma comment(linker, "/STACK:16777216")

#define eps 0.0000001

#define MD 1000000007

typedef long long ll;

using namespace std;

ll n;
vector <ll> ans;

int check(ll x,ll I){
	double S=0;
	For(i,1,I) S+=(((double)x)/(double)(((ll)1)<<i));
	double tmp=(((double)x)/(double)(((ll)1)<<I));
	S+=((tmp*(tmp-1))/2);
	if ((abs(S-(double)n)<=eps)&&(!(x%(((ll)1)<<I)))&&(((x/(((ll)1)<<I))%2)==1)) return 2;
	if (S>n) return 1;else return 0;
}

int main(){
	scanf("%I64d",&n);
	For(i,0,63){
		ll L=1,R=n+1,res=-1;
		while(R-L>1){
			ll MID=(R+L)/2,QQQ=check(MID,i);
			if (QQQ==2) {res=MID;break;}
			if (QQQ==1) R=MID-1;
			if (!QQQ) L=MID+1;
		}
		if (check(L,i)==2) res=L;else
			if (check(R,i)==2) res=R;
		if (res!=-1) ans.pb(res);
	}
	sort(ans.begin(),ans.end());
	if (!ans.size()) puts("-1");else
		FOR(i,0,ans.size()) printf("%I64d\n",ans[i]);
	//system("pause");
}


#include <iostream>
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <algorithm>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define inf 2000000000LL
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define For(i,s,n) for (ll i=s;i<=n;i++)
#define FOR(i,s,n) for (int i=s;i<n;i++)
#define Ford(i,s,n) for (int i=s;i>=n;i--)
#pragma comment(linker, "/STACK:16777216")

#define eps 0.0000001

#define MD 1000000007

typedef long long ll;

using namespace std;

vector <ll> ans;
ll n;

int main(){
	scanf("%I64d",&n);
	For(i,0,63){
		if (((1LL)<<i)>n+1) break;
		ll L=1,R=Min((n+1)/((1LL)<<i),inf);
		while(R>=L){
			ll MID=(L+R)/2,S=0;
			if (!(MID%2)){
				if (MID+1<=R) MID++;else if (MID-1>=L) MID--;else break;
			}
			FOR(j,0,i)
				S+=((1LL<<j)*MID);
			S+=((MID*(MID-1))/2);
			if (S==n) {ans.pb(MID*(1LL<<i));break;}
			if (S>n) R=MID-1;else L=MID+1;
		}
	}
	sort(ans.begin(),ans.end());
	if (!ans.size()) puts("-1");else
		FOR(i,0,ans.size()) printf("%I64d\n",ans[i]);
	//system("pause");
}


#include <iostream>
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <algorithm>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define inf 2000000000LL
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define For(i,s,n) for (ll i=s;i<=n;i++)
#define FOR(i,s,n) for (int i=s;i<n;i++)
#define Ford(i,s,n) for (int i=s;i>=n;i--)
#pragma comment(linker, "/STACK:16777216")

#define eps 0.0000001

#define MD 1000000007

typedef long long ll;

using namespace std;

ll n;
vector <ll> ans;

int check(ll x,ll I){
	double S=0;
	For(i,1,I) S+=(((double)x)/(double)(((ll)1)<<i));
	double tmp=(((double)x)/(double)(((ll)1)<<I));
	S+=((tmp*(tmp-1))/2);
	if ((abs(S-(double)n)<=eps)&&(!(x%(((ll)1)<<I)))&&(((x/(((ll)1)<<I))%2)==1)) return 2;
	if (S>n) return 1;else return 0;
}

int main(){
	scanf("%I64d",&n);
	For(i,0,63){
		ll L=1,R=n+1,res=-1;
		while(R-L>1){
			int MID=(R+L)/2,QQQ=check(MID,i);
			if (QQQ==2) {res=MID;break;}
			if (QQQ==1) R=MID-1;
			if (!QQQ) L=MID+1;
		}
		if (check(L,i)==2) res=L;else
			if (check(R,i)==2) res=R;
		if (res!=-1) ans.pb(res);
	}
	sort(ans.begin(),ans.end());
	if (!ans.size()) puts("-1");else
		FOR(i,0,ans.size()) printf("%I64d\n",ans[i]);
	//system("pause");
}


#include <iostream>
#include <cstdio>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <sstream>
#include <algorithm>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define inf 2000000000LL
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define For(i,s,n) for (ll i=s;i<=n;i++)
#define FOR(i,s,n) for (int i=s;i<n;i++)
#define Ford(i,s,n) for (int i=s;i>=n;i--)
#pragma comment(linker, "/STACK:16777216")

#define eps 0.0000001

#define MD 1000000007

typedef long long ll;

using namespace std;

vector <ll> ans;
ll n;

int main(){
	scanf("%I64d",&n);
	For(i,0,63){
		if (((1LL)<<i)>n+1) break;
		ll L=1,R=(n+1)/((1LL)<<i);
		while(R>=L){
			ll MID=(L+R)/2,S=0;
			if (!(MID%2)){
				if (MID+1<=R) MID++;else if (MID-1>=L) MID--;else break;
			}
			FOR(j,0,i)
				S+=((1LL<<j)*MID);
			S+=((MID*(MID-1))/2);
			if (S==n) {ans.pb(MID*(1LL<<i));break;}
			if (S>n) R=MID-1;else L=MID+1;
		}
	}
	sort(ans.begin(),ans.end());
	if (!ans.size()) puts("-1");else
		FOR(i,0,ans.size()) printf("%I64d\n",ans[i]);
	//system("pause");
}


#include<stdio.h>
#include<string.h>
#include<cmath>
#include<vector>
#include<iostream>

using std::cin;
using std::cout;
using std::vector;

#define MAXN 7
#define MAXV 1000000000

#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))

vector<long long> ans;

int main()
{
	long long n;
	long long d;

	cin>>n;

	ans.clear();

	for (int i = 0 ;  ; i++)
	{
		long long d = ((long long)(1) << i);	//otherwise 1 << 33 == 1 << 1 !!
		long long r = n - (d - 1);
		if (r < 0) break;
		bool ok = false;
		long long mid;
		if (r == 0)
		{
			ok = true;
			mid = 0;
		}

		if (!ok)
		{
			long long rr = r >> 1;	//rr = r/2 >= m^2
			long long p = 0;
			while (rr)
			{
				rr >>= 1;
				p++;
			}
			//upper bound of m: suppose rr has p digits, then m has at most (p+2)/2 digits instead of p/2 digits!!
			p >>= 1;	p += 1;
			long long right = (long long)(1) << p;
			long long left = 1;

			long long dd = (d << 1) - 1;

			while (!ok && left <= right)
			{
				mid = (left + right)/2;
				long long q = 2 * mid * mid;
				long long res = r - q;

				long long qq = res / mid;

				if (res % mid == 0)
				{
					if (qq == dd)
					{
						ok = true;
						break;
					} else
					if (qq < dd)
					{
						right = mid - 1;
					} else
					{
						//qq > dd
						left = mid + 1;
					}
				} else
				{
					if (qq >= dd)
					{
						left = mid + 1;
					} else
					{
						//if (qq < dd)
						if (qq + 1 <= dd)
						{
							right = mid - 1;
						} else
						{
							long long closeres = mid * dd;
							if (res > closeres)
							{
								left = mid + 1;
							} else
							{
								right = mid - 1;
							}
						}
					}
				}
			}
		}

		if (ok)
		{
			long long t_ans = d * (2 * mid + 1);
			ans.push_back(t_ans);
			for (int i = ans.size() - 2 ; i >= 0 ; i--)
			{
				if (t_ans < ans[i]) ans[i+1] = ans[i]; else { ans[i+1] = t_ans; break; }
			}
		}

	}

	if (ans.size() == 0)
	{
		cout<<"-1\n";
	} else
	{
		for (int i = 0 ; i < ans.size() ; i++) cout<<ans[i]<<"\n";
	}

	return 0;
}

/*

t = 2^k * (2m+1)
n = (2^k - 1)(2m+1)+(2m+1)m

d = 2^k

n-(d-1) = r = 2m^2 + (2d-1)m

WA: 249999998807430810

1414213558

k = 1
2m+1 = 707106779
m = 353553389

*/


#include<stdio.h>
#include<string.h>
#include<cmath>
#include<vector>
#include<iostream>

using std::cin;
using std::cout;
using std::vector;

#define MAXN 7
#define MAXV 1000000000

#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))

vector<long long> ans;

int main()
{
	long long n;
	long long d;

	cin>>n;

	ans.clear();

	for (int i = 0 ;  ; i++)
	{
		long long d = (1 << i);
		long long r = n - (d - 1);
		if (r < 0) break;
		bool ok = false;
		long long mid;
		if (r == 0)
		{
			ok = true;
			mid = 0;
		}

		if (!ok)
		{
			long long rr = r >> 1;
			int p = 0;
			while (rr)
			{
				rr >>= 1;
				p++;
			}
			p >>= 1;
			long long right = 1 << p;
			long long left = 1;

			long long dd = (d << 1) - 1;

			while (!ok && left <= right)
			{
				mid = (left + right)/2;
				long long q = 2 * mid * mid;
				long long res = r - q;

				long long qq = res / mid;

				if (res % mid == 0)
				{
					if (qq == dd)
					{
						ok = true;
						break;
					} else
					if (qq < dd)
					{
						right = mid - 1;
					} else
					{
						//qq > dd
						left = mid + 1;
					}
				} else
				{
					if (qq >= dd)
					{
						left = mid + 1;
					} else
					{
						//if (qq < dd)
						if (qq + 1 <= dd)
						{
							right = mid - 1;
						} else
						{
							long long closeres = mid * dd;
							if (res > closeres)
							{
								left = mid + 1;
							} else
							{
								right = mid - 1;
							}
						}
					}
				}
			}
		}

		if (ok)
		{
			long long t_ans = d * (2 * mid + 1);
			ans.push_back(t_ans);
			for (int i = ans.size() - 2 ; i >= 0 ; i--)
			{
				if (t_ans < ans[i]) ans[i+1] = ans[i]; else { ans[i+1] = t_ans; break; }
			}
		}

	}

	if (ans.size() == 0)
	{
		cout<<"-1\n";
	} else
	{
		for (int i = 0 ; i < ans.size() ; i++) cout<<ans[i]<<"\n";
	}

	return 0;
}


#include<stdio.h>
#include<string.h>
#include<cmath>
#include<vector>
#include<iostream>

using std::cin;
using std::cout;
using std::vector;

#define MAXN 7
#define MAXV 1000000000

#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))

vector<long long> ans;

int main()
{
	long long n;
	long long d;

	cin>>n;

	ans.clear();

	for (int i = 0 ;  ; i++)
	{
		long long d = ((long long)(1) << i);	//otherwise 1 << 33 == 1 << 1 !!
		long long r = n - (d - 1);
		if (r < 0) break;
		bool ok = false;
		long long mid;
		if (r == 0)
		{
			ok = true;
			mid = 0;
		}

		if (!ok)
		{
			long long rr = r >> 1;
			int p = 0;
			while (rr)
			{
				rr >>= 1;
				p++;
			}
			p >>= 1;
			long long right = 1 << p;
			long long left = 1;

			long long dd = (d << 1) - 1;

			while (!ok && left <= right)
			{
				mid = (left + right)/2;
				long long q = 2 * mid * mid;
				long long res = r - q;

				long long qq = res / mid;

				if (res % mid == 0)
				{
					if (qq == dd)
					{
						ok = true;
						break;
					} else
					if (qq < dd)
					{
						right = mid - 1;
					} else
					{
						//qq > dd
						left = mid + 1;
					}
				} else
				{
					if (qq >= dd)
					{
						left = mid + 1;
					} else
					{
						//if (qq < dd)
						if (qq + 1 <= dd)
						{
							right = mid - 1;
						} else
						{
							long long closeres = mid * dd;
							if (res > closeres)
							{
								left = mid + 1;
							} else
							{
								right = mid - 1;
							}
						}
					}
				}
			}
		}

		if (ok)
		{
			long long t_ans = d * (2 * mid + 1);
			ans.push_back(t_ans);
			for (int i = ans.size() - 2 ; i >= 0 ; i--)
			{
				if (t_ans < ans[i]) ans[i+1] = ans[i]; else { ans[i+1] = t_ans; break; }
			}
		}

	}

	if (ans.size() == 0)
	{
		cout<<"-1\n";
	} else
	{
		for (int i = 0 ; i < ans.size() ; i++) cout<<ans[i]<<"\n";
	}

	return 0;
}

/*
TLE: 1113860392
*/


#pragma comment(linker, "/STACK:33554432")

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <memory.h>

using namespace std;

typedef unsigned long long LL;

LL n;

LL S(LL X, bool ok)
{
	ok = 1;
	LL L = 0, R = 3LL * 1000 * 1000 * 1000;
	while (R - L > 1)
	{
		LL M = (L + R) / 2;
		if (M * M > X)
			R = M;
		else
			L = M;
	}
	if (L * L == X)
		return L;
	ok = 0;
	return 0;
}

int main()
{
	scanf("%I64d", &n);
	set<LL> res;
	bool ok;
	LL s = S(n * 8 + 1, ok);
	if (ok)
	{
		if (s & 1)
			res.insert((s + 1) / 2);
	}
	for(int k = 1; k <= 59; ++k)
	{
		LL B = 2LL * ((1LL << k) - 1) - 1;
		LL R = (8LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000) / B + 1;
		R = min(R, 3LL * 1000 * 1000 * 1000);
		LL L = 1;
		while (R - L > 1)
		{
			LL M = (L + R) / 2;
			if (2LL * M * B + M * (M + 1) - M > 8LL * n)
				R = M;
			else
				L = M;
		}
		if (2LL * L * B + L * (L + 1) - L == 8LL * n)
		{
			if (L % 2 == 0)
				res.insert((1LL << k) * L / 2);
		}
	}
	if (res.size() == 0)
	{
		printf("-1\n");
		return 0;
	}
	for(set<LL> :: iterator it = res.begin(); it != res.end(); ++it)
		printf("%I64d\n", *it);
	return 0;
}


#pragma comment(linker, "/STACK:33554432")

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <memory.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

LL n;

LL S(LL X)
{
	LL L = 0, R = 3LL * 1000 * 1000 * 1000;
	while (R - L > 1)
	{
		LL M = (L + R) / 2;
		if (M * M > X)
			R = M;
		else
			L = M;
	}
	if (L * L == X)
		return L;
	return -1;
}

int main()
{
	scanf("%I64d", &n);
	set<LL> res;
	LL s = S(n * 8 + 1);
	if (s != -1)
	{
		if (s & 1)
			res.insert((s + 1) / 2);
	}
	for(int k = 1; k <= 59; ++k)
	{
		LL B = 2LL * ((1LL << k) - 1) - 1;
		LL R = (2LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000) / B + 1;
		R = min(R, 3LL * 1000 * 1000 * 1000);
		LL L = 1;
		while (R - L > 1)
		{
			LL M = (L + R) / 2;
			if (2LL * M * B + M * (M + 1) - M > 8LL * n)
				R = M;
			else
				L = M;
		}
		if (2LL * L * B + L * (L + 1) - L == 8LL * n)
		{
			if (L % 2 == 0)
				res.insert((1LL << k) * L / 2);
		}
	}
	if (res.size() == 0)
	{
		printf("-1\n");
		return 0;
	}
	for(set<LL> :: iterator it = res.begin(); it != res.end(); ++it)
		printf("%I64d\n", *it);
	return 0;
}


#pragma comment(linker, "/STACK:33554432")

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <memory.h>

using namespace std;

typedef unsigned long long LL;

LL n;

int main()
{
	cin >> n;
	vector<LL> res;
	for(int i = 0; i <= 59; ++i)
	{
		LL a = 1LL << i;
		LL L = 1, R = min((LL)2e9, n / a + 1) + 1;
		while (R - L > 1)
		{
			LL M = (L + R) / 2;
			if (M * (M - 1) / 2 + (a - 1) * M > n)
				R = M;
			else
				L = M;
		}
		if (L * (L - 1) / 2 + (a - 1) * L == n && (L & 1))
			res.push_back(L * a);
	}
	if (res.empty())
		cout << -1 << endl;
	else
		for(int i = 0; i < res.size(); ++i)
			cout << res[i] << endl;
	return 0;
}


#pragma comment(linker, "/STACK:33554432")

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <memory.h>

using namespace std;

typedef unsigned long long LL;

LL n;

LL S(LL X, bool ok)
{
	ok = 1;
	LL L = 0, R = 3LL * 1000 * 1000 * 1000;
	while (R - L > 1)
	{
		LL M = (L + R) / 2;
		if (M * M > X)
			R = M;
		else
			L = M;
	}
	if (L * L == X)
		return L;
	ok = 0;
	return 0;
}

int main()
{
	scanf("%I64d", &n);
	set<LL> res;
	bool ok;
	LL s = S(n * 8 + 1, ok);
	if (ok)
	{
		if (s & 1)
			res.insert((s + 1) / 2);
	}
	for(int k = 1; k <= 59; ++k)
	{
		LL B = 2LL * ((1LL << k) - 1) - 1;
		LL R = (8LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000) / B + 1;
		if (R > 3LL * 1000 * 1000 * 1000)
                      R = 3LL * 1000 * 1000 * 1000;
		LL L = 1;
		while (R - L > 1)
		{
			LL M = (L + R) / 2;
			if (2LL * M * B + M * (M + 1) - M > 8LL * n)
				R = M;
			else
				L = M;
		}
		if (2LL * L * B + L * (L + 1) - L == 8LL * n)
		{
			if (L % 2 == 0)
				res.insert((1LL << k) * L / 2);
		}
	}
	if (res.size() == 0)
	{
		printf("-1\n");
		return 0;
	}
	for(set<LL> :: iterator it = res.begin(); it != res.end(); ++it)
		printf("%I64d\n", *it);
	return 0;
}


#pragma comment(linker, "/STACK:33554432")

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <memory.h>

using namespace std;

typedef unsigned long long LL;

LL n;

LL S(LL X, bool ok)
{
	ok = 1;
	LL L = 0, R = 3LL * 1000 * 1000 * 1000;
	while (R - L > 1)
	{
		LL M = (L + R) / 2;
		if (M * M > X)
			R = M;
		else
			L = M;
	}
	if (L * L == X)
		return L;
	ok = 0;
	return 0;
}

int main()
{
	scanf("%I64d", &n);
	set<LL> res;
	bool ok;
	LL s = S(n * 8 + 1, ok);
	if (ok)
	{
		if (s & 1)
			res.insert((s + 1) / 2);
	}
	for(int k = 1; k <= 59; ++k)
	{
		LL B = 2LL * ((1LL << k) - 1) - 1;
		LL R = (4LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000) / B + 1;
		R = min(R, 3LL * 1000 * 1000 * 1000);
		LL L = 1;
		while (R - L > 1)
		{
			LL M = (L + R) / 2;
			if (2LL * M * B + M * (M + 1) - M > 8LL * n)
				R = M;
			else
				L = M;
		}
		if (2LL * L * B + L * (L + 1) - L == 8LL * n)
		{
			if (L % 2 == 0)
				res.insert((1LL << k) * L / 2);
		}
	}
	if (res.size() == 0)
	{
		printf("-1\n");
		return 0;
	}
	for(set<LL> :: iterator it = res.begin(); it != res.end(); ++it)
		printf("%I64d\n", *it);
	return 0;
}


#define DEBUG
#define HOME

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = "input.txt"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = "output.txt"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)
#define int long long
#define float long double
#define fillArr( n, a )  for ( int i=0; i<n; i++ ) cin >> a[i] ;
#define fillArr2( n, a, b ) for ( int i=0; i<n; i++ ) cin >> a[i] >> b[i];
#define for2(i, a1, a2) for ( int (i) = (a1); (i)<(a2); (i)++ )
#define mp( a, b ) make_pair ( a, b )
#define add( a, b ) a.push_back ( b )
#define sz(a) (int) a.size( )
using namespace std;

int n;
set <int> ans;
vector <int> div1;
map <int, bool> tavan2;

int make ( int a ){
    int t = a * (a-1)/2;
    if ( t == n )
        return a;
    int r = a;
    while ( t <= n ){
        t += r;
        r *= 2;
        if ( t == n )
            return r;
    }
}

void bins( int s, int e, int k  ){
    if ( s >= e ){
        if ( s % 2 == 0 )
            s++;
        int r = ( k - 1 + s/2 ) * s ;
        if ( r== n ){
            ans.insert ( make ( s ) );
        }
        return;
    }
    int t = ( s + e )/2;
    int tt =t;
    if ( t % 2 == 0 )
        tt = t +1;
    int r = ( k - 1 + tt/2 ) * tt ;
    if ( r== n ){
        ans.insert ( make ( tt ) );
    }
    if ( r >= n || r < 0 )
        bins ( s, t, k );
    else
        bins ( t+1, e, k );
}

void main ( ){
    ios::sync_with_stdio ( false );
    int k=1;
    cin >> n;
    while ( k <= 1e18 ){
        bins ( 0, 2 *1e9+4, k );
        tavan2[k] = true;
        k *= 2;
    }
    /*while ( n % 2 == 0 )
        n /= 2;
    div1.push_back ( n );
    for ( int i=3; i*i<=n; i++ ){
        int j = i;
        bool is = false;
        while ( n % i == 0 ){
            i *= j;
            is = 1;
        }
        if ( is )
            i /= j;
        if ( n % i == 0 ){
            div1.push_back ( i );
            if ( i * i != n )
                div1.push_back ( n/i );
            n /= i;
            i = 3;
        }
    }
    for2 ( i, 0, sz(div1) ){
        if ( div1[i] % 2 == 0 )
            continue;
        int y = (div1[i]-1)/2;
        int r = n / div1[i];
        if ( tavan2[r - y + 1] ){
            ans.insert ( make ( div1[i] ) );
        }
    }*/
    if ( !ans.size( ) ){
        puts ("-1");
        return;
    }
    for ( set <int>::iterator it = ans.begin( ); it != ans.end( ); it++ )
        cout << *it << endl;
}


#define DEBUG
#define HOME

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = "input.txt"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = "output.txt"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)
#define int long long
#define float long double
#define fillArr( n, a )  for ( int i=0; i<n; i++ ) cin >> a[i] ;
#define fillArr2( n, a, b ) for ( int i=0; i<n; i++ ) cin >> a[i] >> b[i];
#define for2(i, a1, a2) for ( int (i) = (a1); (i)<(a2); (i)++ )
#define mp( a, b ) make_pair ( a, b )
#define add( a, b ) a.push_back ( b )
#define sz(a) (int) a.size( )
using namespace std;

class BigNum{
public:
    vector <int> digit;
    bool pos;

    BigNum ( ){
        pos = true;
    }

    BigNum ( string s ){
        for ( int i = s.size ( )-1; i>=0; i-- )
            digit.push_back ( int (s[i] - '0') );
        pos = true;
    }

    BigNum ( int s ){
        while ( s ){
            digit.push_back ( s % 10 );
            s /= 10;
        }
        pos = true;
    }

    int operator[] ( int i ){
        if (i< this->digit.size ( ))
            return this->digit[i];
        return 0;
    }

    int& operator( ) ( int i ){
        if (i< this->digit.size ( ))
            return this->digit[i];
    }

    int getInt ( ){
        int k=0;
        for ( int i = digit.size ( ) -1; i >= 0; i-- ){
            k*=10;
            k+=digit[i];
        }
        return k;
    }

    void delZero ( ){
        if ( !digit.size( ) )
            return;
        while ( *digit.rbegin( ) == 0 )
            digit.pop_back( );
    }
};

BigNum operator+ ( BigNum a, BigNum b ){
    BigNum sum;
    int des =0;
    int size = a.digit.size ( ) > b.digit.size( ) ? a.digit.size( ) : b.digit.size ( );
    for ( int i=0; i<size; i++){
        sum.digit.push_back ( ( a[i] + b[i] + des) % 10 );
        des = ( a[i] + b[i] + des) / 10;
    }
    if (des)
        sum.digit.push_back ( des );
    sum.delZero( );
    return sum;
}

bool operator < ( BigNum a, BigNum b ){
    if (a.digit.size ( ) < b.digit.size ( ))
        return true;
    if (a.digit.size ( ) > b.digit.size ( ))
        return false;
    for ( int i=a.digit.size ( ); i>=0; i--){
        if ( a[i] > b[i] )
            return false;
        if ( a[i] < b[i] )
            return true;
    }
    return false;
}

BigNum operator - ( BigNum a, BigNum b ){
    if ( a < b ){
        BigNum tmp = b-a;
        tmp.pos = false;
        return tmp;
    }

    BigNum sub;
    int rem = 0;
    for ( int i=0; i< a.digit.size ( ); i++ ){
        if ( b[i] <= a[i] ){
            sub.digit.push_back ( a[i] - b[i] );
        }
        else{
            int j = i-1;
            while ( !a[++j] ){
                if ( j==i)
                    a(j) = 10;
                else
                    a(j) = 9;
            }
            if ( j == i ){
                a(j) += 10;
                a(j+1)--;
            }
            else
                a(j)--;
            sub.digit.push_back ( a[i] - b[i] );
        }
    }
    sub.delZero ( );
    return sub;
}

BigNum operator * ( BigNum a, BigNum b ){
    BigNum mult;
    for ( int i=0; i<b.digit.size ( ); i++){
        int des = 0;
        BigNum tmp;
        for ( int j=0; j<i; j++ )
            tmp.digit.push_back ( 0 );
        for ( int j=0; j<a.digit.size ( ); j++){
            tmp.digit.push_back ( (b[i] * a[j] + des) % 10 );
            des = (b[i] * a[j] + des) / 10;
        }
        if (des)
            tmp.digit.push_back ( des );
        mult = mult + tmp;
    }
    mult.delZero( );
    return mult;
}

bool operator ==  ( BigNum a, BigNum b ){
    if (a.digit.size ( )!=b.digit.size ( ))
        return false;
    for ( int i=0; i<a.digit.size ( ); i++)
        if ( a[i] != b[i] )
            return false;
    return true;
}

int n;
set <BigNum> ans;
vector <int> div1;
map <int, bool> tavan2;

BigNum make ( int a ){
    BigNum t = int(a * (a-1)/2);
    if ( t == n )
        return a;
    BigNum r = a;
    while ( ! ( n < t ) ){
        t = t + r;
        r = r * 2;
        if ( t == n )
            return r;
    }
}

ostream & operator << (ostream & cout, BigNum a){
    if ( !a.pos )
        cout <<"-";
    bool first = true;
    for ( int i=a.digit.size ( )-1; i>=0; i--){
        if (a[i] || (!first) || !i){
            cout << a[i];
            first = false;
        }
    }
    return cout;
}

void bins( int s, int e, int k  ){
    if ( s >= e ){
        if ( s % 2 == 0 )
            s++;
        BigNum r = ( BigNum(k - 1 + s/2) ) * BigNum(s) ;
        if ( r== n ){
            ans.insert ( make ( s ) );
        }
        return;
    }
    int t = ( s + e )/2;
    int tt =t;
    if ( t % 2 == 0 )
        tt = t +1;
    BigNum r = ( BigNum(k - 1 + tt/2) ) * BigNum(tt) ;
    if ( r== n ){
        ans.insert ( make ( tt ) );
    }
    if ( !((r < BigNum(n)) ) )
        bins ( s, t, k );
    else
        bins ( t+1, e, k );
}

//void bins2( int s, int e, int k  ){
//  if ( s >= e ){
//      if ( s % 2 == 0 )
//          s++;
//      int r = ( k - 1 + s/2 ) * s ;
//      if ( r== n ){
//          ans.insert ( make ( s ) );
//      }
//      return;
//  }
//  int t = ( s + e )/2;
//  int tt =t;
//  if ( t % 2 == 0 )
//      tt = t -1;
//  if ( tt == -1 )
//      tt =1;
//  int r = ( k - 1 + tt/2 ) * tt ;
//  if ( r== n ){
//      ans.insert ( make ( tt ) );
//  }
//  if ( r >= n || r < 0 )
//      bins2 ( s, t, k );
//  else
//      bins2 ( t+1, e, k );
//}

void main ( ){
    ios::sync_with_stdio ( false );
    int k=1;
    cin >> n;
    while ( k <= 1e18 ){
    //  cout << k << endl;
        bins ( 0, 2 *1e9+4, k );
        tavan2[k] = true;
        k *= 2;
    }
    if ( !ans.size( ) ){
        puts ("-1");
        return;
    }
    for ( set <BigNum>::iterator it = ans.begin( ); it != ans.end( ); it++ )
        cout << *it << endl;
}


#define DEBUG
#define HOME

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = "input.txt"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = "output.txt"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)
#define int long long
#define float long double
#define fillArr( n, a )  for ( int i=0; i<n; i++ ) cin >> a[i] ;
#define fillArr2( n, a, b ) for ( int i=0; i<n; i++ ) cin >> a[i] >> b[i];
#define for2(i, a1, a2) for ( int (i) = (a1); (i)<(a2); (i)++ )
#define mp( a, b ) make_pair ( a, b )
#define add( a, b ) a.push_back ( b )
#define sz(a) (int) a.size( )
using namespace std;

class BigNum{
public:
    vector <int> digit;
    bool pos;

    BigNum ( ){
        pos = true;
    }

    BigNum ( string s ){
        for ( int i = s.size ( )-1; i>=0; i-- )
            digit.push_back ( int (s[i] - '0') );
        pos = true;
    }

    BigNum ( int s ){
        while ( s ){
            digit.push_back ( s % 10 );
            s /= 10;
        }
        pos = true;
    }

    int operator[] ( int i ){
        if (i< this->digit.size ( ))
            return this->digit[i];
        return 0;
    }

    int& operator( ) ( int i ){
        if (i< this->digit.size ( ))
            return this->digit[i];
    }

    int getInt ( ){
        int k=0;
        for ( int i = digit.size ( ) -1; i >= 0; i-- ){
            k*=10;
            k+=digit[i];
        }
        return k;
    }

    void delZero ( ){
        while ( *digit.rbegin( ) == 0 )
            digit.pop_back( );
    }

};

BigNum operator+ ( BigNum a, BigNum b ){
    BigNum sum;
    int des =0;
    int size = a.digit.size ( ) > b.digit.size( ) ? a.digit.size( ) : b.digit.size ( );
    for ( int i=0; i<size; i++){
        sum.digit.push_back ( ( a[i] + b[i] + des) % 10 );
        des = ( a[i] + b[i] + des) / 10;
    }
    if (des)
        sum.digit.push_back ( des );
    sum.delZero( );
    return sum;
}

bool operator < ( BigNum a, BigNum b ){
    if (a.digit.size ( ) < b.digit.size ( ))
        return true;
    if (a.digit.size ( ) > b.digit.size ( ))
        return false;
    for ( int i=a.digit.size ( ); i>=0; i--){
        if ( a[i] > b[i] )
            return false;
        if ( a[i] < b[i] )
            return true;
    }
    return false;
}

BigNum operator - ( BigNum a, BigNum b ){
    if ( a < b ){
        BigNum tmp = b-a;
        tmp.pos = false;
        return tmp;
    }

    BigNum sub;
    int rem = 0;
    for ( int i=0; i< a.digit.size ( ); i++ ){
        if ( b[i] <= a[i] ){
            sub.digit.push_back ( a[i] - b[i] );
        }
        else{
            int j = i-1;
            while ( !a[++j] ){
                if ( j==i)
                    a(j) = 10;
                else
                    a(j) = 9;
            }
            if ( j == i ){
                a(j) += 10;
                a(j+1)--;
            }
            else
                a(j)--;
            sub.digit.push_back ( a[i] - b[i] );
        }
    }
    sub.delZero ( );
    return sub;
}

BigNum operator * ( BigNum a, BigNum b ){
    BigNum mult;
    for ( int i=0; i<b.digit.size ( ); i++){
        int des = 0;
        BigNum tmp;
        for ( int j=0; j<i; j++ )
            tmp.digit.push_back ( 0 );
        for ( int j=0; j<a.digit.size ( ); j++){
            tmp.digit.push_back ( (b[i] * a[j] + des) % 10 );
            des = (b[i] * a[j] + des) / 10;
        }
        if (des)
            tmp.digit.push_back ( des );
        mult = mult + tmp;
    }
    mult.delZero( );
    return mult;
}

bool operator ==  ( BigNum a, BigNum b ){
    if (a.digit.size ( )!=b.digit.size ( ))
        return false;
    for ( int i=0; i<a.digit.size ( ); i++)
        if ( a[i] != b[i] )
            return false;
    return true;
}

int n;
set <BigNum> ans;
vector <int> div1;
map <int, bool> tavan2;

BigNum make ( int a ){
    BigNum t = int(a * (a-1)/2);
    if ( t == n )
        return a;
    BigNum r = a;
    while ( ! ( n < t ) ){
        t = t + r;
        r = r * 2;
        if ( t == n )
            return r;
    }
}

ostream & operator << (ostream & cout, BigNum a){
    if ( !a.pos )
        cout <<"-";
    bool first = true;
    for ( int i=a.digit.size ( )-1; i>=0; i--){
        if (a[i] || (!first) || !i){
            cout << a[i];
            first = false;
        }
    }
    return cout;
}

void bins( int s, int e, int k  ){
    if ( s >= e ){
        if ( s % 2 == 0 )
            s++;
        BigNum r = ( BigNum(k - 1 + s/2) ) * BigNum(s) ;
        if ( r== n ){
            ans.insert ( make ( s ) );
        }
        return;
    }
    int t = ( s + e )/2;
    int tt =t;
    if ( t % 2 == 0 )
        tt = t +1;
    BigNum r = ( BigNum(k - 1 + tt/2) ) * BigNum(tt) ;
    if ( r== n ){
        ans.insert ( make ( tt ) );
    }
    if ( !((r < BigNum(n)) ) )
        bins ( s, t, k );
    else
        bins ( t+1, e, k );
}

//void bins2( int s, int e, int k  ){
//  if ( s >= e ){
//      if ( s % 2 == 0 )
//          s++;
//      int r = ( k - 1 + s/2 ) * s ;
//      if ( r== n ){
//          ans.insert ( make ( s ) );
//      }
//      return;
//  }
//  int t = ( s + e )/2;
//  int tt =t;
//  if ( t % 2 == 0 )
//      tt = t -1;
//  if ( tt == -1 )
//      tt =1;
//  int r = ( k - 1 + tt/2 ) * tt ;
//  if ( r== n ){
//      ans.insert ( make ( tt ) );
//  }
//  if ( r >= n || r < 0 )
//      bins2 ( s, t, k );
//  else
//      bins2 ( t+1, e, k );
//}

void main ( ){
    ios::sync_with_stdio ( false );
    int k=1;
    cin >> n;
    while ( k <= 1e18 ){
    //  cout << k << endl;
        bins ( 0, 2 *1e9+4, k );
        if ( k == n )
            ans.insert ( k );
        tavan2[k] = true;
        k *= 2;
    }
    if ( !ans.size( ) ){
        puts ("-1");
        return;
    }
    for ( set <BigNum>::iterator it = ans.begin( ); it != ans.end( ); it++ )
        cout << *it << endl;
}


#define DEBUG
#define HOME

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = "input.txt"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = "output.txt"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)
#define int long long
#define float long double
#define fillArr( n, a )  for ( int i=0; i<n; i++ ) cin >> a[i] ;
#define fillArr2( n, a, b ) for ( int i=0; i<n; i++ ) cin >> a[i] >> b[i];
#define for2(i, a1, a2) for ( int (i) = (a1); (i)<(a2); (i)++ )
#define mp( a, b ) make_pair ( a, b )
#define add( a, b ) a.push_back ( b )
#define sz(a) (int) a.size( )
using namespace std;

class BigNum{
public:
    vector <int> digit;
    bool pos;

    BigNum ( ){
        pos = true;
    }

    BigNum ( string s ){
        for ( int i = s.size ( )-1; i>=0; i-- )
            digit.push_back ( int (s[i] - '0') );
        pos = true;
    }

    BigNum ( int s ){
        while ( s ){
            digit.push_back ( s % 10 );
            s /= 10;
        }
        pos = true;
    }

    int operator[] ( int i ){
        if (i< this->digit.size ( ))
            return this->digit[i];
        return 0;
    }

    int& operator( ) ( int i ){
        if (i< this->digit.size ( ))
            return this->digit[i];
    }

    int getInt ( ){
        int k=0;
        for ( int i = digit.size ( ) -1; i >= 0; i-- ){
            k*=10;
            k+=digit[i];
        }
        return k;
    }

    void delZero ( ){
        if ( !digit.size( ) )
            return;
        while ( *digit.rbegin( ) == 0 )
            digit.pop_back( );
    }

};

BigNum operator+ ( BigNum a, BigNum b ){
    BigNum sum;
    int des =0;
    int size = a.digit.size ( ) > b.digit.size( ) ? a.digit.size( ) : b.digit.size ( );
    for ( int i=0; i<size; i++){
        sum.digit.push_back ( ( a[i] + b[i] + des) % 10 );
        des = ( a[i] + b[i] + des) / 10;
    }
    if (des)
        sum.digit.push_back ( des );
    sum.delZero( );
    return sum;
}

bool operator < ( BigNum a, BigNum b ){
    if (a.digit.size ( ) < b.digit.size ( ))
        return true;
    if (a.digit.size ( ) > b.digit.size ( ))
        return false;
    for ( int i=a.digit.size ( ); i>=0; i--){
        if ( a[i] > b[i] )
            return false;
        if ( a[i] < b[i] )
            return true;
    }
    return false;
}

BigNum operator - ( BigNum a, BigNum b ){
    if ( a < b ){
        BigNum tmp = b-a;
        tmp.pos = false;
        return tmp;
    }

    BigNum sub;
    int rem = 0;
    for ( int i=0; i< a.digit.size ( ); i++ ){
        if ( b[i] <= a[i] ){
            sub.digit.push_back ( a[i] - b[i] );
        }
        else{
            int j = i-1;
            while ( !a[++j] ){
                if ( j==i)
                    a(j) = 10;
                else
                    a(j) = 9;
            }
            if ( j == i ){
                a(j) += 10;
                a(j+1)--;
            }
            else
                a(j)--;
            sub.digit.push_back ( a[i] - b[i] );
        }
    }
    sub.delZero ( );
    return sub;
}

BigNum operator * ( BigNum a, BigNum b ){
    BigNum mult;
    for ( int i=0; i<b.digit.size ( ); i++){
        int des = 0;
        BigNum tmp;
        for ( int j=0; j<i; j++ )
            tmp.digit.push_back ( 0 );
        for ( int j=0; j<a.digit.size ( ); j++){
            tmp.digit.push_back ( (b[i] * a[j] + des) % 10 );
            des = (b[i] * a[j] + des) / 10;
        }
        if (des)
            tmp.digit.push_back ( des );
        mult = mult + tmp;
    }
    mult.delZero( );
    return mult;
}

bool operator ==  ( BigNum a, BigNum b ){
    if (a.digit.size ( )!=b.digit.size ( ))
        return false;
    for ( int i=0; i<a.digit.size ( ); i++)
        if ( a[i] != b[i] )
            return false;
    return true;
}

int n;
set <BigNum> ans;
vector <int> div1;
map <int, bool> tavan2;

BigNum make ( int a ){
    BigNum t = int(a * (a-1)/2);
    if ( t == n )
        return a;
    BigNum r = a;
    while ( ! ( n < t ) ){
        t = t + r;
        r = r * 2;
        if ( t == n )
            return r;
    }
}

ostream & operator << (ostream & cout, BigNum a){
    if ( !a.pos )
        cout <<"-";
    bool first = true;
    for ( int i=a.digit.size ( )-1; i>=0; i--){
        if (a[i] || (!first) || !i){
            cout << a[i];
            first = false;
        }
    }
    return cout;
}

void bins( int s, int e, int k  ){
    if ( s >= e ){
        if ( s % 2 == 0 )
            s++;
        BigNum r = ( BigNum(k - 1 + s/2) ) * BigNum(s) ;
        if ( r== n ){
            ans.insert ( make ( s ) );
        }
        return;
    }
    int t = ( s + e )/2;
    int tt =t;
    if ( t % 2 == 0 )
        tt = t +1;
    BigNum r = ( BigNum(k - 1 + tt/2) ) * BigNum(tt) ;
    if ( r== n ){
        ans.insert ( make ( tt ) );
    }
    if ( !((r < BigNum(n)) ) )
        bins ( s, t, k );
    else
        bins ( t+1, e, k );
}

//void bins2( int s, int e, int k  ){
//  if ( s >= e ){
//      if ( s % 2 == 0 )
//          s++;
//      int r = ( k - 1 + s/2 ) * s ;
//      if ( r== n ){
//          ans.insert ( make ( s ) );
//      }
//      return;
//  }
//  int t = ( s + e )/2;
//  int tt =t;
//  if ( t % 2 == 0 )
//      tt = t -1;
//  if ( tt == -1 )
//      tt =1;
//  int r = ( k - 1 + tt/2 ) * tt ;
//  if ( r== n ){
//      ans.insert ( make ( tt ) );
//  }
//  if ( r >= n || r < 0 )
//      bins2 ( s, t, k );
//  else
//      bins2 ( t+1, e, k );
//}

void main ( ){
    ios::sync_with_stdio ( false );
    int k=1;
    cin >> n;
    while ( k <= 1e18 ){
    //  cout << k << endl;
        bins ( 0, 2 *1e9+4, k );
        if ( k == n )
            ans.insert ( k );
        tavan2[k] = true;
        k *= 2;
    }
    if ( !ans.size( ) ){
        puts ("-1");
        return;
    }
    for ( set <BigNum>::iterator it = ans.begin( ); it != ans.end( ); it++ )
        cout << *it << endl;
}


#define DEBUG
#define HOME

#ifdef HOME

#include <iostream>
#define input_f
#define output_f

#else

#include <fstream>

#define input_f \
    string gtmp = "input.txt"; \
    ifstream cin ( gtmp.c_str( ) )

#define output_f \
    string gtmp2 = "output.txt"; \
    ofstream cout ( gtmp2.c_str( ) )

#endif

#ifdef DEBUG

#define bLog(x) cout << endl << #x << " Started" << endl

#define mLog(x) cout << #x << " = " << x << endl
#define sLog(x) cout << #x << " = " << x << ", "
#define sLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << " "
#define sLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", ";
#define mLog3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define mLog2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define eLog(x) cout << #x << " Ended" << endl << endl
#define nLog cout << endl;

#else

#define bLog(x)
#define mLog(x)
#define mLog2(x, y)
#define mLog3(x, y, z)
#define sLog2(x, y)
#define sLog3(x, y, z)
#define sLog(x)
#define eLog(x)
#define nLog

#endif

#include <sstream>
#include <new>
#include <functional>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <string>
#include <bitset>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

#define inf int(~0u/2)
#define LL_INF 4000000000000000000ll
#define EPS (1e-9)
#define int long long
#define float long double
#define fillArr( n, a )  for ( int i=0; i<n; i++ ) cin >> a[i] ;
#define fillArr2( n, a, b ) for ( int i=0; i<n; i++ ) cin >> a[i] >> b[i];
#define for2(i, a1, a2) for ( int (i) = (a1); (i)<(a2); (i)++ )
#define mp( a, b ) make_pair ( a, b )
#define add( a, b ) a.push_back ( b )
#define sz(a) (int) a.size( )
using namespace std;

int n;
set <int> ans;
vector <int> div1;
map <int, bool> tavan2;

int make ( int a ){
    int t = a * (a-1)/2;
    if ( t == n )
        return a;
    int r = a;
    while ( t <= n ){
        t += r;
        r *= 2;
        if ( t == n )
            return r;
    }
}

void bins( int s, int e, int k  ){
    if ( s >= e ){
        if ( s % 2 == 0 )
            s++;
        int r = ( k - 1 + s/2 ) * s ;
        if ( r== n ){
            ans.insert ( make ( s ) );
        }
        return;
    }
    int t = ( s + e )/2;
    int tt =t;
    if ( t % 2 == 0 )
        tt = t +1;
    int r = ( k - 1 + tt/2 ) * tt ;
    bool is = false;
    if ( k >= 1e9 )
        is |= tt >= 1e9;
    if ( k >= 1e10 )
        is |= tt >= 1e8;
    if ( k >= 1e11 )
        is |= tt >= 1e7;
    if ( k >= 1e12 )
        is |= tt >= 1e6;
    if ( k >= 1e13 )
        is |= tt >= 1e5;
    if ( k >= 1e14 )
        is |= tt >= 1e4;
    if ( k >= 1e15 )
        is |= tt >= 1000;
    if ( k >= 1e16 )
        is |= tt >= 10;
    if ( r== n ){
        ans.insert ( make ( tt ) );
    }
    if ( r >= n || r < 0 || is )
        bins ( s, t, k );
    else
        bins ( t+1, e, k );
}

void main ( ){
    ios::sync_with_stdio ( false );
    int k=1;
    cin >> n;
    while ( k <= 1e18 ){
        bins ( 0, 2 *1e9+4, k );
        tavan2[k] = true;
        k *= 2;
    }
    if ( !ans.size( ) ){
        puts ("-1");
        return;
    }
    for ( set <int>::iterator it = ans.begin( ); it != ans.end( ); it++ )
        cout << *it << endl;
}


#pragma comment (linker, "/STACK:200000000")
#define _SECURE_SCL 0
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <stack>
#include <sstream>
#include <vector>

using namespace std;

typedef long long int64;
const int INF = (int) 1E9;
const int64 INF64 = (int64) 1E18;
const double EPS = 1E-9;
const double PI = acos((double)0) * 2;

#define forn(i,n)  for (int i=0; i<int(n); ++i)
#define ford(i,n)  for (int i=int(n)-1; i>=0; --i)
#define fore(i,l,n)  for (int i=int(l); i<int(n); ++i)
#define all(a)  a.begin(), a.end()
#define fs  first
#define sc  second
#define pb  push_back
#define mp  make_pair

int64 n;

bool read() {
	return !!(cin >> n);
}

int64 my_sqrt(int64 x) {
    int64 l = 0, r = min(x, 2ll * INF + INF / 10);
    while (l < r) {
        int64 m = (l + r + 1) / 2;
        if (m * m <= x)
            l = m;
        else
            r = m - 1;
    }
    return l;
}

typedef vector<int64> lnum;

void norm(lnum &n) {
    int64 c = 0;
    forn(i, n.size()) {
        n[i] += c;
        c = n[i] / INF64;
        n[i] %= INF64;
    }
    if (c)
        n.push_back(c);
}

lnum make_lnum(int64 n, int p) {
    lnum res(1, n);
    norm(res);
    while (p) {
        forn(i, res.size())
            res[i] *= 2;
        norm(res);
        --p;
    }
    return res;
}

bool cmp(const lnum &a, const lnum &b) {
    if (a.size() != b.size())
        return a.size() < b.size();
    ford(i, a.size())
        if (a[i] != b[i])
            return a[i] < b[i];
    return false;
}

void out(const lnum &n) {
    ford(i, n.size()) {
        if (i == (int)n.size()-1) {
            cout.width(0);
            cout << n[i];
        }
        else {
            cout.width(18);
            cout.fill('0');
        }
    }
    puts("");
}

int f(int p, int64 m) {
    int64 pw = 1ll << p;
    double pwd = (double)pw;

    int64 x = 2 * m - 1;
    double xd = (double)x;

    double vald = xd * ((xd - 1) / 2 + pwd - 1);
    if (vald > 2E18)
        return +1;
    int64 val = x * ((x - 1) / 2 + pw - 1);
    return val==n ? 0 : (val<n ? -1 : +1);
}

void solve() {
    vector<int64> ans;
    forn(p, 62) {
        int64 l = 1,  r = INF + 10;
        while (l < r) {
            int64 m = (l + r + 1) / 2;
            if (f(p, m) <= 0)
                l = m;
            else
                r = m - 1;
        }
        if (f(p, l) == 0) {
            int64 x = 2 * l - 1;
            ans.push_back(x << p);
        }
    }

    sort(all(ans));
    if (ans.empty())
        puts("-1");
    else
        forn(i, ans.size())
            cout << ans[i] << endl;
}

int main() {
#ifdef SU2_PROJ
	freopen ("input.txt", "rt", stdin);
	freopen ("output.txt", "wt", stdout);
	while (read())
		solve();
#else
	if (!read())  throw;
	solve();
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = Pow( 2, i ) - 1;

        LL minM = 1, maxM = 10e9 + 10, curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = (curr * (curr - 1)) / 2 + curr*C;

            if ( val == N )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = (1LL << i) - 1;
        if ( C > N ) break;

        if ( C == N )
        {
            res.insert( C + 1 );
            continue;
        }

        LL minM = 1, maxM = 10e9 + 10, curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = curr * (curr - 1) / 2 + curr * C;

            if ( val == N && (curr & 1) )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = Pow( 2, i ) - 1;

        LL minM = 1, maxM = 10e10 + 10, curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = (curr * (curr - 1)) / 2 + curr*C;

            if ( val == N )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    int cnt = 0;
    LL tmp = 178120883699712;
    while ( tmp % 2 == 0 )
    {
        ++cnt;
        tmp /= 2;
    }
    printf( "%d\n", cnt );

    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = (1LL << i) - 1;
        if ( C > N ) break;

        if ( C == N )
        {
            res.insert( C + 1 );
            continue;
        }

        LL minM = 1, maxM = min( 2000000000LL, N / (C+1) ), curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = (curr * (curr - 1)) / 2;// + curr * C;

            if ( val == N - curr*C && (curr & 1) )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N - curr*C )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = Pow( 2, i ) - 1;

        LL minM = 1, maxM = 10e9 + 10, curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = (curr * (curr - 1)) / 2 + curr*C;

            if ( val == N && (curr & 1) )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    /*
    int cnt = 0;
    LL tmp = 178120883699712;
    while ( tmp % 2 == 0 )
    {
        ++cnt;
        tmp /= 2;
    }
    printf( "%d\n", cnt );
    */

    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = (1LL << i) - 1;
        if ( C > N ) break;

        if ( C == N )
        {
            res.insert( C + 1 );
            continue;
        }

        LL minM = 1, maxM = min( 2000000000LL, N / (C+1) ), curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = (curr * (curr - 1)) / 2;// + curr * C;

            if ( val == N - curr*C && (curr & 1) )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N - curr*C )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>
#include <ctime>
#include <assert.h>
#include <string.h>
#include <limits>
using namespace std;

#define INF 100000000
#define PI 3.1415926535897932384626433832795
#define PI_HALF 1.570796327
#define EPS 1e-9

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair< int, int > PII;
typedef pair< LL, LL > PLL;
typedef vector< int > VI;
typedef vector< LL > VLL;
typedef vector< string > VS;
typedef vector< PII > VPII;
typedef vector< PLL > VPLL;

#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define SZ(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort( ALL( c ) )
#define SORT_(c,f) sort( ALL( c ), f )
#define FILL(x,v) memset( x, v, sizeof( x ) );

#define REP(i,n) for ( int i = 0, max_ = (n); i < max_; ++i )
#define REPD(i,n) for ( int i = (n) - 1; i >= 0; --i )
#define FOR(i,a,b) for ( int i = (a), max_ = (b); i < max_; ++i )
#define FORD(i,a,b) for ( int i = (a) - 1, min_ = (b); i >= min_; --i )

LL GCD ( LL a, LL b ) { return b != 0 ? GCD(b, a % b) : a; }
LL LCM ( LL a, LL b ) { return a*(b / GCD(a,b)); }
LL Pow ( LL n, LL e ) { if ( e == 0 ) return 1; if ( e == 1 ) return n; else if ( e & 1 ) { LL t = Pow(n,e/2); return n*t*t; } else { LL t = Pow(n,e/2); return t*t; } }

int main ()
{
    LL N;
    cin >> N;

    set< LL > res;
    REP(i,64)
    {
        LL C = Pow( 2, i ) - 1;
        LL remN = N - C;
        if ( remN == 0 )
        {
            res.insert( C + 1 );
            continue;
        }

        LL minM = 1, maxM = 10e9 + 10, curr;
        while ( minM <= maxM )
        {
            curr = (minM + maxM) / 2;
            LL val = curr * (curr - 1) / 2;

            if ( val == remN && (curr & 1) )
            {
                res.insert( (C + 1) * curr );
                break;
            }

            if ( val < N )
            {
                minM = curr + 1;
            }
            else
            {
                maxM = curr - 1;
            }
        }
    }

    if ( SZ(res) == 0 )
        printf( "-1\n" );
    else
    {
        for ( auto i = res.begin(); i != res.end(); ++i )
            printf( "%I64d\n", *i );
    }

    return 0;
}


#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <ctime>
#include <climits>

using namespace std;

typedef unsigned long long int64;

#define fore(i,a,b) for (int i = (int)a; i < (int)b; i++)
#define forf(i,n) for (int i = 0; i < (int)n; i++)
#define forb(i,n) for (int i = (int)n-1; i >= 0; i--)

#define INF (int)1E9
#define INF64 (int64)1E18

void qs(int64 *a, int l, int r)
{
	int i = l;
	int j = r;
	int64 y,p = a[(l+r)>>1];
	do
	{
		while (a[i] < p && i < r) i++;
		while (a[j] > p && j > l) j--;
		if (i <= j)
		{
			y = a[i];
			a[i] = a[j];
			a[j] = y;
			i++;
			j--;
		}
	} while (i <= j);
	if (i < r) qs(a,i,r);
	if (j > l) qs(a,l,j);
}

int main()
{
	//freopen("input.txt","rt",stdin);
	//freopen("output.txt","wt",stdout);
	int64 n,x,m,t,s,k = 0;
	int64 *a = new int64 [10000];
	cin >> n;
	for (int64 i = 0; i < 61; i++)
	{
		m = (((int64)1)<<i)-1;
		if (m >= n/3) break;
		t = 1000000000;
		x = 3;
		while (t)
		{
			while (!(n/(m+(x-1)/2) <= x)) x += t;
			while (!(n/(m+(x-1)/2) >= x) && x-t >= 3) x -= t;
			t /= 2;
			if (t&1) t--;
		}
		if (x*(m+(x-1)/2) == n)
		{
			s = (x*(x-1))/2;
			t = x;
			while (s != n)
			{
				s += t;
				t *= 2;
			}
			a[k++] = t;
		}
	}
	s = 0;
	t = 1;
	while (s < n)
	{
		s += t;
		t *= 2;
	}
	if (s == n) a[k++] = t;
	if (k)
	{
		qs(a,0,k-1);
		forf(i,k) cout << a[i] << endl;
	}
	else cout << -1 << endl;
	return 0;
}


#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <fstream>
#include <climits>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

// #define FILE

#define INF INT_MAX
#define LINF LLONG_MAX
#define EPS 1e-5
#define MOD 1000000007 // 10**9 + 7
#define MAXN 100001
#define ALPH 26 // Latin alphabet size
#define DALPH 52 // Double Latin alphabet size

#define mp(a, b) make_pair(a, b)

typedef signed short int int16;
typedef unsigned short int uint16;
typedef unsigned long int uint;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef long double real; // in msvc same as double

typedef pair<int, int> pii;

int64 k;
int64 n;

int64 find(int64 l, int64 r) {
    int64 m;

    while(l + 1 < r) {
        m = (l + r) / 2;
        if(m * (m - 1) / 2 + m *((1ll << k) - 1) > n)
            r = m;
        else
            l = m;
    }

    return l;
}

int main() {
    #ifdef FILE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    set<int64> ans;

    scanf("%I64d", &n);
    for(k = 0; ((1ll << k) - 1) <= n; ++k) {
        int64 t = find(1, INF);
        if(t % 2 == 0) continue;
        if(t * (t - 1) / 2 + t * ((1ll << k) - 1) == n)
                ans.insert(t * (1ll << k));
    }

    if(ans.begin() == ans.end()) {
        printf("-1\n");
        return 0;
    }

    for(set<int64>::iterator it = ans.begin(); it != ans.end(); ++it)
        printf("%I64d\n", *it);
}


#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <fstream>
#include <climits>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

// #define FILE

#define INF INT_MAX
#define LINF LLONG_MAX
#define EPS 1e-5
#define MOD 1000000007 // 10**9 + 7
#define MAXN 100001
#define ALPH 26 // Latin alphabet size
#define DALPH 52 // Double Latin alphabet size

#define mp(a, b) make_pair(a, b)

typedef signed short int int16;
typedef unsigned short int uint16;
typedef unsigned long int uint;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef long double real; // in msvc same as double

typedef pair<int, int> pii;

int k ;
int64 n;

int64 find(int64 l, int64 r) {
    int64 m;

    while(l + 1 < r) {
        m = (l + r) / 2;
        if(m * (m - 1) / 2 + m *((1 << k) - 1) > n)
            r = m;
        else
            l = m;
    }

    return l;
}

int main() {
    #ifdef FILE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    set<int64> ans;

    scanf("%I64d", &n);
    for(k = 0; ((1 << k) - 1) <= n; ++k) {
        int64 t = find(1, INF);
        if(t * (t - 1) / 2 + t * ((1 << k) - 1) == n)
                ans.insert(t * (1 << k));
    }

    if(ans.begin() == ans.end()) {
        printf("-1\n");
        return 0;
    }

    for(set<int64>::iterator it = ans.begin(); it != ans.end(); ++it)
        printf("%I64d\n", *it);
}


#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <fstream>
#include <climits>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

// #define FILE

#define INF INT_MAX
#define LINF LLONG_MAX
#define EPS 1e-5
#define MOD 1000000007 // 10**9 + 7
#define MAXN 100001
#define ALPH 26 // Latin alphabet size
#define DALPH 52 // Double Latin alphabet size

#define mp(a, b) make_pair(a, b)

typedef signed short int int16;
typedef unsigned short int uint16;
typedef unsigned long int uint;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef long double real; // in msvc same as double

typedef pair<int, int> pii;

int k ;
int64 n;

int64 find(int64 l, int64 r) {
    int64 m;

    while(l + 1 < r) {
        m = (l + r) / 2;
        if(m * (m - 1) / 2 + m *((1 << k) - 1) > n)
            r = m;
        else
            l = m;
    }

    return l;
}

int main() {
    #ifdef FILE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    set<int64> ans;

    scanf("%I64d", &n);
    for(k = 0; ((1 << k) - 1) <= n; ++k) {
        int64 t = find(1, INF);
        if(t % 2 == 0) continue;
        if(t * (t - 1) / 2 + t * ((1 << k) - 1) == n)
                ans.insert(t * (1 << k));
    }

    if(ans.begin() == ans.end()) {
        printf("-1\n");
        return 0;
    }

    for(set<int64>::iterator it = ans.begin(); it != ans.end(); ++it)
        printf("%I64d\n", *it);
}


#include <iostream>
using namespace std;
void quicksort(long int,long int);
long int partition(long int,long int);
long int a[100000];

void quickSort(long int low,long int high)
{
    long int pi;
    if (low < high)
    {
        pi = partition(low, high);
        quickSort(low, pi - 1);
        quickSort(pi + 1, high);
    }
}

long int partition (long int low,long int high)
{
    long int pivot,i,j,temp;
    pivot = a[high];

    i = (low - 1);

    for (j = low; j <= high- 1; j++)
    {
        if (a[j] <= pivot)
        {
            i++;
            temp=a[i];
            a[i]=a[j];
            a[j]=temp;
        }
    }
    temp=a[i+1];
    a[i+1]=a[high];
    a[high]=temp;
    return (i + 1);
}

int main() {
long int n,i;
cin>>n;
for(i=0;i<n;i++)
{
    cin>>a[i];
}
quickSort(0,n-1);
cout<<a[n-2]-a[0];
return 0;
}


#include <iostream>
using namespace std;

int main() {
	long int n,a[100000],min,i,first,second;
	cin>>n;
	min=100000;
	first=0;
	second=0;
	if(n<=2)
	{
	    for(i=0;i<2;i++)
	    {
	        cin>>a[i];
	    }
	    cout<<"0";
	}
	else
	{
	for(i=0;i<n;i++)
	{
	    cin>>a[i];
	    if(a[i]<min)
	    {
	        min=a[i];
	    }
	    if(a[i]>first)
	    {
	        second=first;
	        first=a[i];
	    }
	    else if((a[i]>second)&&(a[i]!=first))
	    {
	        second = a[i];
	    }
	}
	cout<<second-min;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int a[100010];
int main()
{
	int length;
	cin >> length;
	for (int i = 0; i < length; i++)
	{
		cin >> a[i];
	}
	if (length == 2) cout << 0 << endl;
	else
	{
		sort(a, a + length);
		int subtr1 = 0, subtr2 = 0;
		subtr1 = a[length - 1] - a[1];
		subtr2 = a[length - 2] - a[0];
		if (subtr1 < subtr2) cout << subtr1 << endl;
		else cout << subtr2 << endl;
	}
	return 0;
}


#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;
int a[1000000];
/*int fuck(int n)
{
	int sum=0,i,j;
	for(i=1;i<=54;i++)
	{
		sum+=i;
		if(sum==n)
			return i;
	}
}
int he(int n)
{
	int sum=0;
	int i;
	//int k=fuck(n);
	for(i=1;i<=n;i++)
		sum+=i;
	return sum;
}
int main()
{
	int i,j,n;
	char a[1000000];
	while(~scanf("%d",&n)){
	getchar();
	scanf("%s",a);
	for(i=0;i<=fuck(n);i++)
	{
		int sum=he(i+1);
		printf("%c",a[sum-1]);
		if(i==fuck(n))
			printf("\n");
	}
	}
	return 0;
}*/
int main()
{
	int n;
	while(~scanf("%d",&n))
	{
		int i,j;
		for(i=0;i<n;i++)
			scanf("%d",&a[i]);
		sort(a,a+n);
		int min1=a[n-1]-a[1];
		int min2=a[n-2]-a[0];
		if(min1<min2)
			printf("%d\n",min1);
		else
			printf("%d\n",min2);
	}
}


#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a = new int[n];
	for (int i = 0;i < n;i++)
		cin >> a[i];
	int max = a[0];
	int max2 = a[0];
	int min = a[0];
	int min2 = a[0];
	for (int i = 1;i < n;i++)
	{
		if (a[i] >= max)
		{
			max2 = max;
			max = a[i];
		}
		if (a[i] <= min)
		{
			min2 = min;
			min = a[i];
		}
	}
	if (max2 - min < max - min2)
		cout << max2 - min;
	else
		cout << max - min2;
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a = new int[n];
	for (int i = 0;i < n;i++)
		cin >> a[i];
	int max = a[0];
	int max2 = a[0];
	int min = a[0];
	int min2 = a[0];
	for (int i = 1;i < n;i++)
	{
		if (a[i] >= max)
		{
			max2 = max;
			max = a[i];
		}
		else if (a[i] > max2)
			max2 = a[i];
		if (a[i] <= min)
		{
			min2 = min;
			min = a[i];
		}
		else if (a[i] < min2)
			min2 = a[i];
	}
	if (max2 - min < max - min2)
		cout << max2 - min;
	else
		cout << max - min2;
	return 0;
}


#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int *a = new int[n];
	for (int i = 0;i < n;i++)
		cin >> a[i];
	int max = a[0];
	int max2 = a[1];
	int min = a[0];
	int min2 = a[1];
	for (int i = 1;i < n;i++)
	{
		if (a[i] >= max)
		{
			max2 = max;
			max = a[i];
		}
		else if (a[i] > max2)
			max2 = a[i];
		if (a[i] <= min)
		{
			min2 = min;
			min = a[i];
		}
		else if (a[i] < min2)
			min2 = a[i];
	}
	if (max2 - min < max - min2)
		cout << max2 - min;
	else
		cout << max - min2;
	return 0;
}