1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
n=int(input())
b=[0]
k=0
i=0
d=0
while k<n:
    i+=1
    c=i
    while c%2==0:
        d-=1
        c//=2
    d+=1
    b.append(d)
    k+=d
#print(*b)
h=[]
k-=n
while k:
    if k>=b[i]:
        k-=b[i]
        i-=1
        continue
    h.append(i)
    i-=1
print(len(h)+i)
print(*h,end=" ")
print(* reversed(range(1,i+1)))