#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; const ll INF=1e18; map m; void f(int x){ queue que; ll now=1; que.push(1); while(now<=INF){ if(!m.count(now)) m[now]=x; que.push(now); now*=2; if(que.size()>x){ now-=que.front(); que.pop(); } } } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); for(int i=2;i<70;i++) f(i); ll n; cin>>n; if(m.count(n)) cout<