1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
a = [0]
b = [0]
m = 0
while a[-1]<1000000:
	m += 1
	b.append(bin(m).count("1"))
	a.append(a[-1]+b[-1])
n = int(input())
c = []
while n>0:
	if a[m-1]<n:
		c.append(m)
		n -= b[m]
	m -= 1
print(len(c))
print(*c)