#include <stdio.h>

int main()
{
    int N = 114067; // input value, can be read with scanf()
    int currentLength = 0; // here we will store the current number of consecutive ones
    int bestLength = 0; // here we will store the best result

    while (N) // as long as N is greater than 1
    {
        if (N&1) // if the last bit is set to 1
        {
            // cool, let's increment the current sequence's length
            currentLength += 1;

            // currentLength has changed, maybe now it is better than best known solution?
            if (currentLength > bestLength)
            {
                // awesome! new best solution is found
                bestLength = currentLength;
            }
        }
        else
        {
            // we have encountered 0 while scanning bits, we must start counting the length over
            currentLength = 0;
        }

        // let's move to the next bit!
        N = N>>1;
    }

    printf("%d", bestLength); // print out the value

    return 0;
}