#include #include #include using namespace std; int henkan(int num){ int c=0; while(num>0){ if(num%2==1){ c++; } num = num/2; } return c++; } int solv(int N){ int walk; vector flag(N+1,0); int pos = 1, count = 1; while(true){ flag[pos] = 1; walk = henkan(pos); if(pos+walk == N){ return count+1; }else if(pos+walk < N){ if(flag[pos+walk]==0){ pos = pos+walk; count++; } }else{ if(flag[pos-walk] == 0){ pos = pos-walk; count++; }else{ return -1; } } } } int main(){ int N; cin>>N; cout<