#include <cstdio>
#include <cstring>
#define MAXN (1 << 10)
using namespace std;

typedef long long ll;

int a[MAXN + 10];
int n;

inline void read ()
{
    scanf ("%d", &n);
}

inline void makeCases ()
{
    a[4] = a[3] = 2;
    for (int i=3; i <= 10; ++i)
    {
        int cur = (1 << (i-1))+1;

        for (int j=0; cur <= (1 << i); ++j)
        {
            a[cur] = i;
            //printf ("a[%d] = %d\n", cur, i);
            cur += (1 << j);
        }
    }
}

void solveWithBinary ()
{
    for (int len=3; ; ++len)
        for (ll prev=1; prev <= (1LL << 11); ++prev)
        {
            ll l=1, r=5000, m;
            ll mult = (1LL << (len-2)) * (prev + 1LL);
            //printf ("mult %lld ", mult);
            ll other = prev;
            //printf ("other %lld\n", other);
            ll lastGood = -1;
            //printf ("%d %lld\n", len, prev);
            while (l <= r)
            {
                m = (l + r) / 2LL;
               // printf ("mid %lld %lld (%lld / %lld): %lld ", m, mult, (mult*(m+1)), (other*m), (mult*(m+1)) / (other*m) );
                if ( (mult*(m+1)) / (other*m) >= n )
                {
                    l = m+1;
                    lastGood = m;
                }
                else r = m-1;
            }
            //printf ("lastgood = %lld\n", lastGood);

            if ((mult * (lastGood + 1)) / (other*lastGood) == n)
                if ((mult * (lastGood + 1)) % (other*lastGood) == 0)
                {
                    printf ("%d\n", len);
                    return ;
                }
        }
    printf ("23\n");
    return ;
}

inline void solve ()
{
    memset (a, 0x7f, sizeof (a));
    int maxx = a[0];

    makeCases ();
    //printf ("out");
    if (a[n] != maxx)
    {
        printf ("%d\n", a[n]);
        return;
    }
    // fcuk
    solveWithBinary ();
}

int main ()
{
    read ();
    solve ();
    return 0;
}
