Daniel is organizing a football tournament. He has come up with the following tournament format:   In the first several (possibly zero) stages, while the number of teams is even, they split in pairs and play one game for each pair. At each stage the loser of each pair is eliminated (there are no draws). Such stages are held while the number of teams is even.  Eventually there will be an odd number of teams remaining. If there is one team remaining, it will be declared the winner, and the tournament ends. Otherwise each of the remaining teams will play with each other remaining team once in round robin tournament (if there are x teams, there will be $\frac{x \cdot(x - 1)}{2}$ games), and the tournament ends. 

For example, if there were 20 teams initially, they would begin by playing 10 games. So, 10 teams would be eliminated, and the remaining 10 would play 5 games. Then the remaining 5 teams would play 10 games in a round robin tournament. In total there would be 10+5+10=25 games.

Daniel has already booked the stadium for n games. Help him to determine how many teams he should invite so that the tournament needs exactly n games. You should print all possible numbers of teams that will yield exactly n games in ascending order, or -1 if there are no such numbers.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 10^18), the number of games that should be played.

Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.


-----Output-----

Print all possible numbers of invited teams in ascending order, one per line. If exactly n games cannot be played, output one number: -1.


-----Examples-----
Input
3

Output
3
4

Input
25

Output
20

Input
2

Output
-1

Difficulty: MEDIUM_HARD
Tags: Sorting

Mathematics
Skill types: Sorting

Starter code:

Solutions:
3
y = int(input())
s = set()
e = 1
for k in range(0, 70):
	b = 2 * e - 3
	c = -2 * y
	d = b * b - 4 * c
	if d >= 0:
		L = 0
		R = d
		while True:
			M = (L + R + 1) // 2
			if L == R:
				break
			MM = M * M
			if MM > d:
				R = M - 1
			else:
				L = M
		if M * M == d:
			x = -b + M
			if x > 0 and x % 2 == 0:
				x //= 2
				if x % 2 == 1:
					s.add(x * e)
			x = -b - M
			if x > 0 and x % 2 == 0:
				x //= 2
				if x % 2 == 1:
					s.add(x * e)
	e <<= 1
y = True
for x in sorted(s):
	print(x)
	y = False
if y:
	print(-1)


from math import sqrt

def solve(b, c):
	d = b * b - 4 * c
	sd = int(sqrt(d))
	for i in range(-10, 10):
		if (sd - i) * (sd - i) == d:
			sd -= i
			break
	if sd * sd != d:
		return []
	if (sd + b) % 2 != 0:
		return []
	if sd == 0:
		return [-b // 2]
	return [(-b - sd) // 2, (-b + sd) // 2]
n = int(input())
r = 0
ans = []
for i in range(128):
	if i > 0:
		r += pow(2, i - 1)
	k = pow(2, i)
	nn = n * 2
	a = solve(2 * r - 1, -nn)
	for i in a:
		if i > 0 and i % 2 == 1:
			ans.append(i * k)
ans = list(set(ans))
ans.sort()
for i in ans:
	print(i)
if len(ans) == 0:
	print(-1)


import math

def root(n):
	(l, r) = (int(0), int(10 ** 20))
	while l <= r:
		m = (l + r) // 2
		if m * m == n:
			return m
		elif m * m > n:
			r = m - 1
		else:
			l = m + 1
	return int(l)
n = int(input())
ans = []
a = 0
for i in range(63):
	disc = int((2 * a - 1) * (2 * a - 1) + 8 * n)
	r = root(disc)
	if r * r == disc and r % 2 == 1:
		x = (1 - 2 * a + r) // 2
		y = (1 - 2 * a - r) // 2
		if x % 2 == 1 and x > 0:
			ans.append(int(x * (a + 1)))
		if y % 2 == 1 and y > 0:
			ans.append(int(y * (a + 1)))
	a = 2 * a + 1
if len(ans) == 0:
	print(-1)
else:
	ans = list(set(ans))
	for x in ans:
		print(int(x))


n = int(input())
f = 0
for p in range(63):
	N = 1 << p + 1
	l = 0
	h = n
	while h >= l:
		m = (l + h) // 2
		x = m * 2 + 1
		res = x * (x + N - 3)
		if res == n * 2:
			print(x * (1 << p))
			f = 1
			break
		elif res > n * 2:
			h = m - 1
		else:
			l = m + 1
if f == 0:
	print(-1)


n = int(input()) * 2

def calc(d):
	(mi, ma) = (1, n)
	md = 0
	while mi != ma:
		md = (mi + ma) // 2
		if md * (md + d) < n:
			mi = md + 1
		else:
			ma = md
	return ma if ma * (ma + d) == n and ma % 2 else -1
d = 1
li = []
while d <= n:
	d *= 2
	u = calc(d - 3)
	if u != -1:
		li.append(u * d // 2)
li.sort()
if len(li):
	for d in li:
		print(d)
else:
	print(-1)


n = int(input()) + 1
(b, p) = (1, [])
while b < n + 1:
	d = (2 * b - 1) ** 2 + 8 * (n - b)
	s = int(d ** 0.5)
	s += int((d // s - s) // 2)
	if s * s == d:
		a = s - (2 * b - 1)
		if a % 4 == 0:
			p.append(b * (a // 2 + 1))
	b *= 2
print('\n'.join(map(str, p)) if p else '-1')


def cc(res):
	l = 1
	r = res
	while l <= r:
		mid = l + r >> 1
		if mid * mid == res:
			return mid
		elif mid * mid > res:
			r = mid - 1
		else:
			l = mid + 1
	return -1

def solve(a, b, c):
	if b * b - 4 * a * c < 0:
		return -1
	r = cc(b * b - 4 * a * c)
	if r * r != b * b - 4 * a * c:
		return -1
	r = -b + r
	if r % (2 * a) != 0:
		return -1
	return int(r / 2 / a)
n = int(input())
tmp = []
for i in range(0, 100):
	now = 1 << i + 1
	ans = solve(1, now - 3, -2 * n)
	if ans != -1 and ans % 2 == 1:
		tmp.append(int(ans * now / 2))
tmp.sort()
pre = -1
for i in tmp:
	if i != pre:
		print(i)
	pre = i
if pre == -1:
	print(-1)


f = n = int(input())
N = 1
while N <= n * 2:
	(l, h) = (0, n)
	while h >= l:
		m = (l + h) // 2
		r = (m * 2 + 1) * (m + N - 1)
		if r > n:
			h = m - 1
		elif r < n:
			l = m + 1
		else:
			print(m * 2 * N + N)
			f = 0
			break
	N *= 2
if f:
	print(-1)


def get(x):
	low = 1
	high = x
	ans = -1
	while low <= high:
		mid = (low + high) // 2
		if mid * mid <= x:
			low = mid + 1
			ans = mid
		else:
			high = mid - 1
	return ans
n = int(input())
f = 0
for i in range(0, 64):
	a = 1
	b = 2 ** (i + 1) - 3
	c = -2 * n
	d = b * b - 4 * a * c
	sq = get(d)
	if sq ** 2 == d:
		x = -b + sq
		if x & 1 == 0 and x // 2 & 1 and (x // 2 > 0):
			f = 1
			ans = (x >> 1) * (1 << i)
			print(ans)
if f == 0:
	print(-1)


N = int(input().strip())
possib = False
nos = set()

def isqrt(n):
	x = n
	y = (x + 1) // 2
	while y < x:
		x = y
		y = (x + n // x) // 2
	return x

def test(x, b, c):
	global nos
	if x * x != b * b - 4 * c:
		return
	x -= b
	if x % 2 == 1:
		return
	x //= 2
	if x % 2 == 1:
		nos.add(x * 2 ** i)
for i in range(0, 61):
	b = 2 ** (i + 1) - 3
	c = -2 * N
	if b * b - 4 * c < 0:
		continue
	x = isqrt(b * b - 4 * c)
	test(x, b, c)
if len(nos) == 0:
	print(-1)
else:
	for x in sorted(list(nos)):
		print(x)


def sqrt(num):
	l = 0
	r = 10 ** 20 + 9
	while l < r:
		m = l + r >> 1
		if m * m > num:
			r = m
		else:
			l = m + 1
	l -= 1
	return l
n = int(input())
p = 0
cp = 1
ans = []
while p <= n:
	sq = 8 * n + (1 - 2 * p) ** 2
	q = sqrt(sq)
	if q * q == sq:
		xtimes2 = q - 2 * p + 1
		if xtimes2 % 2 == 0:
			x = xtimes2 // 2
			if x % 2 and p * x + x * (x - 1) // 2 == n:
				ans.append(x * cp)
	p += cp
	cp *= 2
print(*sorted(set(ans) if ans else [-1]), sep='\n')


N = int(input())
e = 1
B = False
while True:
	a = 1
	b = N + 1
	if a * (a - 3) // 2 + e * a > N:
		break
	while b - a > 1:
		c = (b + a) // 2
		if e * c + c * (c - 3) // 2 <= N:
			a = c
		else:
			b = c
	if (a % 2 != 0) & (e * a + a * (a - 3) // 2 == N):
		B = True
		print(a * e)
	e *= 2
if B == False:
	print(-1)


def main():
	from math import sqrt
	n = int(input())
	ans = []
	m = 0
	num = 1
	gps = 0

	def bns(C):
		l = 0
		r = int(1e+18)
		ans = -1
		while l <= r:
			mid = l + (r - l) // 2
			if (mid - 1) * mid // 2 + mid * C < n:
				l = mid + 1
			else:
				ans = mid
				r = mid - 1
		return ans
	while gps <= n:
		k = bns(gps)
		if (k - 1) * k // 2 + k * gps == n and k % 2 == 1:
			ans.append(num * k)
		m += 1
		num *= 2
		gps = num - 1
	if len(ans):
		print(*ans, sep='\n')
	else:
		print(-1)
	return
main()


def f(n, k):
	return n * (n - 1) // 2 + n * (pow(2, k) - 1)
a = int(input())
ans = []
for k in range(0, 65):
	(l, r) = (0, pow(10, 10))
	while r - l > 1:
		mid = (l + r) // 2
		if f(mid, k) <= a:
			l = mid
		else:
			r = mid
	if f(l, k) == a and l % 2 != 0:
		ans.append(l * pow(2, k))
ans = list(set(ans))
ans = sorted(ans)
if len(ans) == 0:
	print(-1)
else:
	for x in ans:
		print(x)


n = int(input())

def f(t, k):
	return t * (t - 1) // 2 + t * ((1 << k) - 1)
ans = set()
for k in range(60):
	l = 0
	r = n
	p = 0
	while l <= r:
		t = (l + r) // 2
		if f(t, k) <= n:
			p = t
			l = t + 1
		else:
			r = t - 1
	if p % 2 == 1 and f(p, k) == n:
		ans.add(p * (1 << k))
for x in sorted(ans):
	print(x)
if not ans:
	print(-1)


import sys
from math import sqrt

def solve(b, c):
	D = b * b - 4 * c
	if D < 0:
		return []
	kek = int(sqrt(D))
	d = -1
	for i in range(-10, 10, 1):
		if kek + i < 0:
			continue
		if (kek + i) ** 2 == D:
			d = kek + i
			break
	if d < 0:
		return []
	if (b + d) % 2:
		return []
	res = []
	if -b - d > 0 and (-b - d) // 2 % 2:
		res.append((-b - d) // 2)
	if -b + d > 0 and (-b + d) // 2 % 2:
		res.append((-b + d) // 2)
	return res

def Solve():
	n = int(input())
	ans = set()
	kek = solve(-1, -2 * n)
	for i in kek:
		ans.add(i)
	for t in range(60):
		b = 2 ** (t + 2) - 3
		c = -2 * n
		kek = solve(b, c)
		for i in kek:
			ans.add(i * 2 ** (t + 1))
	if not ans:
		print('-1')
		return
	for i in ans:
		print(i)
Solve()


match = int(input())
arr = []
for k in range(0, 65):
	pw = 2 ** k
	l = -1
	r = 10 ** 18
	while l + 1 < r:
		m = (l + r) // 2
		x = 2 * m + 1
		res = x * (pw - 1) + x * (x - 1) // 2
		if res >= match:
			r = m
		else:
			l = m
	x = 2 * r + 1
	res = x * (pw - 1) + x * (x - 1) // 2
	if res == match:
		arr.append(x * pw)
if len(arr) == 0:
	print(-1)
else:
	arr.sort()
	for i in arr:
		print(i, end=' ')


n = int(input())
succ = False
for ii in range(0, 100):
	i = 2 ** ii
	l = 1
	r = 2 ** 100
	while l < r:
		mid = (l + r) // 2
		x = 2 * mid - 1
		v = x * ((x - 1) // 2 + i - 1)
		if v == n:
			succ = True
			print(x * i)
			break
		elif v < n:
			l = mid + 1
		else:
			r = mid
if not succ:
	print('-1')


n = int(input())

def f(k, p):
	p = 2 * p - 1
	return p * (2 ** k - 1) + p * (p - 1) // 2
ans = set()
for k in range(65):
	l = 0
	r = n + 2
	while l + 1 < r:
		m = (l + r) // 2
		if f(k, m) < n:
			l = m
		else:
			r = m
	if f(k, r) > n:
		continue
	while f(k, r + 1) == n:
		r += 1
	for i in range(l + 1, r + 1):
		ans.add(2 ** k * (2 * i - 1))
for x in sorted(ans):
	print(x)
if not ans:
	print(-1)


import sys
try:
	file = open('input.txt', 'r')
	sys.stdin = file
	file = open('output.txt', 'w')
	sys.stdout = file
except:
	...
n = int(input())
Sum_pow_2 = [1]
ans = []
for i in range(1, 70):
	l = len(Sum_pow_2)
	Sum_pow_2.append(Sum_pow_2[l - 1] + 2 ** i)
	if n == Sum_pow_2[l - 1]:
		ans.append(2 ** i)
l = 0
r = 10 ** 20
while l + 2 < r:
	mid = (l + r) // 2
	mid -= 1 - mid % 2
	if mid * (mid - 1) // 2 <= n:
		l = mid
	else:
		r = mid
if l * (l - 1) // 2 == n:
	ans.append(l)
i = 1
while 2 ** i <= n:
	l = 0
	r = 10 ** 20
	while l + 2 < r:
		mid = (l + r) // 2
		mid -= 1 - mid % 2
		if mid * Sum_pow_2[i - 1] + mid * (mid - 1) // 2 <= n:
			l = mid
		else:
			r = mid
	if l * Sum_pow_2[i - 1] + l * (l - 1) // 2 == n:
		ans.append(2 ** i * l)
	i += 1
ans.sort()
if len(ans) == 0:
	print(-1)
else:
	for i in range(0, len(ans)):
		print(ans[i], sep='', end='\n')


from math import sqrt
n = int(input())
resp = set()
for y in range(1, 65):
	delta = 2 ** (2 * y) - 2 ** (y + 1) * 3 + 9 + 8 * n
	raiz = -1
	(l, r) = (0, int(sqrt(delta)) + 10)
	while l <= r:
		m = (l + r) // 2
		if m * m == delta:
			raiz = m
			break
		elif m * m < delta:
			l = m + 1
		else:
			r = m - 1
	if raiz == -1:
		continue
	x1 = (3 - 2 ** y + raiz) // 2
	x2 = (3 - 2 ** y - raiz) // 2
	if x1 % 2 == 1:
		x1 = x1 * 2 ** (y - 1)
		if x1 >= 1:
			resp.add(x1)
	if x2 % 2 == 1:
		x2 = x2 * 2 ** (y - 1)
		if x2 >= 1:
			resp.add(x2)
if len(resp) == 0:
	print('-1')
else:
	for e in sorted(resp):
		print(e)


from sys import *
import math

def sqr(x):
	return x * x

def Sqrt(x):
	l = 0
	r = 2 ** 150
	while r - l > 1:
		m = (l + r) // 2
		if m * m < x:
			l = m
		else:
			r = m
	if r * r <= x:
		return r
	else:
		return l
fi = stdin
fo = stdout
n = int(fi.readline())
ans = []
o = 1
while o <= 2 ** 100:
	d = sqr(2 * o - 3) + 8 * n
	if d >= 0:
		sd = Sqrt(d)
		if d == sd * sd:
			if (-(2 * o - 3) + sd) % 2 == 0:
				x1 = (-(2 * o - 3) + sd) // 2
				x2 = (-(2 * o - 3) - sd) // 2
				if x1 > 0 and x1 % 2 == 1:
					ans.append(o * x1)
				if x2 > 0 and x2 % 2 == 1:
					ans.append(o * x2)
	o = o * 2
f = 0
for x in sorted(ans):
	fo.write(str(x) + '\n')
	f = 1
if f == 0:
	fo.write('-1\n')


import math
n = int(input())
c = 1
fl = False
a = []
while c <= 8 * n:
	c *= 2
	D = (c - 3) * (c - 3) + 8 * n
	x = int(math.sqrt(D))
	for i in range(-5, 5):
		if x + i < 0:
			continue
		if (x + i) * (x + i) == D:
			x = x + i
	if x * x != D:
		continue
	y = -(c - 3) + x
	if y % 2 == 1:
		continue
	y //= 2
	if y % 2 == 0:
		continue
	k = c // 2 * y
	fl = True
	a.append(k)
a.sort()
for i in a:
	print(i)
if not fl:
	print(-1)


import sys

def isqrt(n):
	l = -1
	h = n
	while l + 1 < h:
		m = (l + h) // 2
		if m * m <= n:
			l = m
		else:
			h = m
	return l
with sys.stdin as fin, sys.stdout as fout:
	n = int(next(fin))
	ans = []
	for i in range(64 + 1):
		a = 2 ** i - 1
		q = 1 - 4 * a + 4 * a ** 2 + 8 * n
		rt = isqrt(q)
		if rt ** 2 != q:
			continue
		res = 1 - 2 * a + rt
		if res % 2 != 0 or res % 4 == 0:
			continue
		ans.append(res // 2 * 2 ** i)
	if not ans:
		print(-1, file=fout)
	else:
		for i in ans:
			print(i, file=fout)


def calc(n):
	res = 0
	while n % 2 == 0:
		n //= 2
		res += n
	return res + n * (n - 1) // 2

def check(n, q):
	if 2 ** q - 1 > n:
		return None
	left = 0
	right = 10 ** 10
	f = lambda k: k * (k - 1) // 2 + k * (2 ** q - 1)
	while left + 1 < right:
		mid = (left + right) // 2
		if f(mid) <= n:
			left = mid
		else:
			right = mid
	count = left * 2 ** q
	if calc(count) == n:
		return count
	else:
		return None
n = int(input())
ans = set()
for q in range(0, 64):
	k = check(n, q)
	if k:
		ans.add(k)
if ans:
	for i in sorted(ans):
		assert calc(i) == n, 'n=%d, i=%d' % (n, i)
		print(i)
else:
	print(-1)


from math import *
y = 0

def sqrt(n):
	l = -1
	r = n + 1
	while l + 1 < r:
		m = (l + r) // 2
		if m * m >= n:
			r = m
		else:
			l = m
	return r

def get_n(x):
	b = 2 ** (x + 1) - 3
	d = b ** 2 + 8 * y
	if d <= 0:
		return []
	else:
		sd = sqrt(d)
		if sd * sd == d and sd - b > 0 and ((sd - b) % 2 == 0) and ((sd - b) % 4 != 0):
			return [(sd - b) // 2 * 2 ** x]
	return []
y = int(input())
res = set()
for x in range(100):
	a = get_n(x)
	for b in a:
		res.add(b)
if len(res) == 0:
	print(-1)
res = sorted(list(res))
for b in res:
	print(b)


from decimal import *

def is_int(d):
	return d == int(d)
getcontext().prec = 40
n = Decimal(input())
l = []
p2 = Decimal(1)
for i in range(70):
	d = 9 + 8 * n + 4 * p2 ** 2 - 12 * p2
	x = (3 - 2 * p2 + d.sqrt()) / 2
	if is_int(x):
		if x % 2 == 1:
			l.append(p2 * x)
	p2 = p2 * 2
l.sort()
if len(l) == 0:
	print(-1)
else:
	for i in l:
		print(int(i))


def getCnt(x, len):
	return x * (x - 1) // 2 + x * (2 ** len - 1)
n = int(input())
ans = []
for LEN in range(0, 60):
	(l, r) = (0, int(1e+18))
	while r - l > 1:
		mid = (l + r) // 2
		if getCnt(2 * mid + 1, LEN) <= n:
			l = mid
		else:
			r = mid
	if getCnt(2 * l + 1, LEN) == n:
		x = 2 * l + 1
		ans.append(x * 2 ** LEN)
if len(ans) == 0:
	print(-1)
else:
	print('\n'.join(list(map(str, ans))))


n = int(input())
x = 1
res = []
for i in range(64):
	(lo, hi) = (0, int(1000000000000000.0))
	f = 0
	ans = 0
	while lo + 1 < hi:
		mid = (lo + hi) // 2
		v = (x - 1) * mid + (mid * mid - mid) // 2
		if v == n:
			f = 1
			ans = mid
			break
		if v > n:
			hi = mid
		else:
			lo = mid
	if f and ans % 2 == 1:
		res.append(ans * x)
	x = x * 2
if len(res) == 0:
	print(-1)
	exit(0)
for x in res:
	print(int(x))


import math
from fractions import Decimal
from decimal import *
getcontext().prec = 100
x = Decimal(input())

def tows(n):
	ans = Decimal(0)
	while n > 0:
		ans += Decimal(2 ** n)
		n -= 1
	return ans
k = True
answer = []
for n in range(100, -1, -1):
	d = tows(n)
	b = d - 1
	ans = []
	s = Decimal(Decimal(b ** 2) + Decimal(8 * x))
	s = s.sqrt()
	h = Decimal(-b / 2)
	ans.append(h + s / 2)
	ans.append(h - s / 2)
	for item in ans:
		if item < 1 or item % 2 != 1:
			continue
		answer.append(item * 2 ** n)
		k = False
if k:
	print(-1)
answer.sort()
for item in answer:
	print(int(item))


n = int(input())
res = set()
for r in range(100):
	a = 1
	b = 2 ** (r + 1) - 3
	c = -2 * n
	d = b * b - 4 * a * c
	if d < 0:
		continue
	le = 0
	ri = d
	while le < ri:
		c = (le + ri) // 2
		if c * c < d:
			le = c + 1
		else:
			ri = c
	if le * le == d:
		if (-b - le) % 4 == 2 and -b - le > 0:
			res.add((-b - le) // 2 * 2 ** r)
		if (-b + le) % 4 == 2 and -b + le > 0:
			res.add((-b + le) // 2 * 2 ** r)
for i in sorted(list(res)):
	print(i)
if not list(res):
	print(-1)


import sys
fin = sys.stdin
n = int(fin.readline())

def f(a, k):
	return a * (a - 1) // 2 + a * (2 ** k - 1)

def ff(k):
	result = 0
	while k % 2 == 0:
		k //= 2
		result += k
	result += k * (k - 1) // 2
	return result

def find_a(k):
	(i, j) = (1, n)
	while i <= j:
		m = (i + j) // 2
		value = f(m, k)
		if value == n:
			return m
		if value < n:
			i = m + 1
		else:
			j = m - 1
	return -1
result = set()
for k in range(100):
	a = find_a(k)
	if a != -1:
		t = a * 2 ** k
		if ff(t) == n:
			result.add(t)
if len(result) > 0:
	print(' '.join(map(str, sorted(result))))
else:
	print(-1)


n = eval(input())

def f(x):
	r = 0
	while x > 0 and x % 2 == 0:
		x //= 2
		r += x
	return r + x * (x - 1) // 2
k = -1
r = []
while True:
	g = lambda x: int(2 ** k) * (2 * x + 1)
	if f(int(2 ** k)) > n:
		break
	(ub, lb) = (n, 0)
	while ub - lb > 1:
		mid = (ub + lb) // 2
		if f(g(mid)) <= n:
			lb = mid
		else:
			ub = mid
	if f(g(lb)) == n:
		r.append(g(lb))
	k += 1
if len(r) > 0:
	print(*r, sep='\n')
else:
	print(-1)


def f(x, k):
	return x * (x - 1) // 2 + (2 ** k - 1) * x
res = []
n = int(input())
for k in range(0, 64):
	l = 1
	r = 2 ** 100
	while l < r:
		m = (l + r) // 2
		cur = f(m, k)
		if cur < n:
			l = m + 1
		else:
			r = m
	if f(l, k) != n or l % 2 == 0:
		continue
	cand = 2 ** k * l
	if not cand in res:
		res.append(cand)
if len(res) == 0:
	res.append(-1)
for x in sorted(res):
	print(x)


n = int(input())
ans = []
for i in range(0, 64):
	y = 2 ** i
	deter = (y - 3) ** 2 + 4 * 2 * n
	if deter >= 0:
		sqrt = int(pow(deter, 0.5))
		while sqrt * sqrt < deter:
			sqrt += 1
		while sqrt * sqrt > deter:
			sqrt -= 1
		if sqrt * sqrt == deter:
			ev1 = 3 - y + sqrt
			if ev1 % 2 == 0:
				ev1 /= 2
				if ev1 > 0 and ev1 % 2 == 1:
					for j in range(0, i):
						ev1 *= 2
					ans.append(ev1 / 2)
			ev1 = 3 - y - sqrt
			if ev1 % 2 == 0:
				ev1 /= 2
				if ev1 > 0 and ev1 % 2 == 1:
					for j in range(0, i):
						ev1 *= 2
					ans.append(ev1 / 2)
for i in sorted(ans):
	print(int(i))
if not len(ans):
	print(-1)


showed = False

def func(num, twos):
	ash = num
	num = int(num)
	num = num * (num - 1)
	num //= 2
	num = num + ash * (2 ** twos - 1)
	return num

def decide(twos, num):
	global showed
	(low, hi) = (int(0), int(1e+18))
	ans = int(-1)
	while low <= hi:
		mid = (low + hi) // 2
		pk = mid * 2 - 1
		if func(pk, twos) <= num:
			ans = pk
			low = mid + 1
		else:
			hi = mid - 1
	if func(ans, twos) == num:
		showed = True
		print(ans * 2 ** twos)
ash = int(input())
for i in range(0, 65):
	decide(i, ash)
if showed == False:
	print(-1)


ans = []
n = 1

def f(r, k):
	a = 2 ** k
	a -= 1
	a *= r
	b = r * (r - 1) // 2
	return a + b

def ff(r, k):
	a = 2 ** k
	return a * r

def tr(k):
	if f(1, k) > n:
		return
	l = 1
	r = 2 ** 60
	while r - l > 1:
		mid = (l + r) // 2
		if f(mid, k) < n:
			l = mid + 1
		else:
			r = mid
	while f(l, k) < n:
		l += 1
	if f(l, k) == n and l & 1:
		ans.append(ff(l, k))
n = eval(input())
for i in range(60, -1, -1):
	tr(i)
ans.sort()
if len(ans) == 0:
	print(-1)
	import sys
	sys.exit(0)
for i in ans:
	print(i, end=' ')


import math

def solve(n, b):
	ans = []
	A = 1
	B = 2 * (1 << b) - 3
	C = -2 * n
	if B * B - 4 * A * C >= 0:
		dm = int(math.sqrt(B * B - 4 * A * C))
		ans.append((-1 * B + dm) // 2 * (1 << b))
		ans.append((-1 * B - dm) // 2 * (1 << b))
	return ans
n = int(input())

def check(n, x):
	if x <= 0:
		return 0
	s = 0
	while x % 2 == 0:
		s += x // 2
		x //= 2
	s += x * (x - 1) // 2
	if s == n:
		return 1
	return 0
fin = []
for i in range(64):
	tmp = solve(n, i)
	for j in tmp:
		if check(n, j):
			fin.append(j)
fin = set(fin)
if len(fin) == 0:
	print(-1)
else:
	for i in fin:
		print(i)


import sys
n = int(input())
ans = 1
t = True
while ans // 2 <= n:
	left = 0
	right = n
	while left <= right:
		x = (left + right) // 2
		a = (2 * x + 1) * (x + ans - 1)
		if a == n:
			print(ans * (2 * x + 1))
			t = False
			break
		elif a < n:
			left = x + 1
		else:
			right = x - 1
	ans *= 2
if t == True:
	print(-1)