#40862: __求救


yp11251156@yphs.tp.edu.tw (908-36許安荀)


#include<iostream>
using namespace std;
int main()
{
   ios::sync_with_stdio(0);
   cin.tie(0);
   int a,b=0,c;
   while(cin>>a)
   {
   if(a==0) break;
   c=a+1;
   while(c>0)
   {
    if(c%2==1) break;
    c/=2;
    b++;}
    cout<<b<<"\n";
    b=0;} 
     
}