import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    long[] tmp = [1, 2, 4, 8, 16, 32, 64];
    long ans = -1;
    foreach (i; 0 .. tmp.length)
    {
        if (n >= tmp[i])
        {
            // writeln(tmp[i]);
            ans = max(ans, tmp[i]);
        }
    }
    writeln(ans);

}

long func(long n)
{
    long cnt;
    while (n % 2 == 0)
    {
        n /= 2;
        cnt += 1;
    }
    return cnt;
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
