include <stdio.h>

int main()
{
int digit;
while(scanf("%d", &digit) != EOF)
{
int max = 0;
int dig = 0;
while(digit)
{
if(digit&1 == 1)
{
dig++;
}
else{
dig = 0;
}
if(dig > max)
{
max = dig;
}
digit = digit >> 1;
}
printf("%d\n", max);
}
return 0;
}