#include using namespace std; int main() { int n, locate, bitcount, movenum; int road[10000], through[10000]; cin >> n; locate=0; movenum=99999; for( int i=0; ii+1)movenum=i+1; } road[i]=locate; through[locate]=1; if(0==through[locate])for(int j=locate+1; j>1; j>>=1)through[locate]+=j&1; if(n-1locate-through[locate] || 010000)movenum=-1; cout << movenum << endl; return 0; }