#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll =long long;
using namespace std;
using graph=vector<vector<int>>;
using field=vector<string>;
using p =pair<int,int>;

int main(){
    ll n;
    cin>>n;
    set<ll> s;
    for(ll i=1;i*i<=n;++i){
        if(n%i==0){
            s.insert(i);
            s.insert(n/i);
        }
    }
    for(auto &e:s){
        cout<<e<<endl;
    }
}

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double lld;
 
#define mod 1000000007
#define INF 1e18
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
 
// pb,mp,F,S,MOD,INF should not be used as variable names for any instances... 
 
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define debug(x)
#endif
 
void _print(ll t) {cerr << t;}
void _print(int t) {cerr << t;}
void _print(string t) {cerr << t;}
void _print(char t) {cerr << t;}
void _print(lld t) {cerr << t;}
void _print(double t) {cerr << t;}
void google(int t) {cout << "Case #" << t << ": ";}
 
template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
 
// const int Max=2005;
// vector<ll>edges[Max];
// vector<ll>adj(Max,0);
// check for cases like n=0,n=1 corners which may lead to WA,Costs a lot be careful.... 



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("Error.txt", "w", stderr);
    #endif
   ll i,j,t,n,m,k;
   cin>>n;
   ll ans=INF;
   for(i=0;i<=60;i++)
   {
      ll temp=1ll<<i;
      ans=min(ans,i+n/temp+n%temp);
   }
   cout<<ans<<endl;
    return 0;
}