#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int n;
    while (cin >>n) { // 注意 while 处理多个 case
        int count=0,ans=0;
        while(n!=0)
        {
            if(n%2==1)
            {count++;
            ans=max(ans,count);}
            else
             count=0;
            n=n>>1;
        }
        cout<<ans<<endl;
    }
}
// 64 位输出请用 printf("%lld")