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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e9
#define mod 998244353
#define int ll
#define N 1000005 
using namespace std;
poly all;
int n;
int s[N];
void work(int x)
{
	// cout<<"??"<<x<<'\n';
	if (x==1)
	{
		all.push_back(1);
		return;
	}
	int pos=lower_bound(s+1,s+1000000+1,x)-s;
	all.push_back(pos);
	work(x-__builtin_popcount(pos));
}
void BellaKira()
{
	cin>>n;
	work(n);
	cout<<all.size()<<'\n';
	for (auto u:all) cout<<u<<" ";
}
signed main()
{
	for (int i=1;i<=1000000;i++) s[i]=s[i-1]+__builtin_popcount(i);
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}