#include <bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define em emplace_back
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
using namespace std;
using ll=long long;
using ii=pair<int,int>;
int main() {
#ifdef LOCAL
freopen("input.in","r",stdin);
#endif
IOS;
int t=1;
//cin>>t;
while(t--){
ll x;
cin>>x;
vector<int>ans;
int cur=1;
while(x){
if(x>=cur){
x-=cur;
ans.em(cur);
}
else{
int y=ans.back();
ans.pop_back();
ans.em(y+x);
break;
}
cur++;
}
cout<<ans.size()<<endl;
for(auto i:ans){
cout<<i<<" ";
}
cout<<endl;
}
#ifdef LOCAL
cerr << "\nTime elapsed: " << (1.0 * clock()) / CLOCKS_PER_SEC << " s.\n";
#endif
return 0;
}
Copy