#include using namespace std; typedef long long ll; #define rep(i,l,r) for(int i=(l);i<(r);++i) int main(){ int n; cin>>n; vector bt(n); rep(i,0,n) bt[i]=__builtin_popcount(i+1); set st; int pos=0,cnt=1; while(pos!=n-1){ if(st.count(pos)){cnt=-1; break;} st.insert(pos); cnt++; if(pos+bt[pos]>n-1) pos-=bt[pos]; else pos+=bt[pos]; } cout<