#include using namespace std; struct CWW{CWW(){ios::sync_with_stdio(false);cin.tie(0);}}cww; int main() { int N; cin >> N; int total{1},res{}; bool flag = false; while( true ) { if( total*2 <= N ) { total = total*2; res++; } else if( total*2 > N ) { total += 1; flag = true; } if( total == N ){ break; } } cout << ( flag ? res + 1 : res ) << endl; return 0; }