#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
	ll n;
	cin>>n;
	if(n==2) {
		cout<<1;
		return;
	}
	ll i=1LL;
	while(((i*(i+1))/2)<=(n+1))
	i++;
	ll res=  n-(i-1)+1;
	cout<<res;
	
}
int main() {
	solve();
	// your code goes here
	return 0;
}
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep1(i,n) for (int i=1;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, ll>;

int main() {
  int n;
  cin >> n;
  int mx = 1, th = 2;

  rep(i,n){
    if(i+1 == th){
      mx++;
      th *= 2;
    }
    cout << mx << " ";
  }
  cout << endl;
  return 0;
}