program ABC068B
    implicit none
    integer(8)::N,count_break,i,j
    integer(8)::result=1
    integer(8)::break_max=0
    read(5,*)N

    do i=1,N
        count_break=0
        j=i
        do
            if(mod(j,2)==0)then
                count_break=count_break+1
                j=j/2
            else
                exit
            end if
        end do

        if(count_break>break_max)then
            break_max=count_break
            result=i
        end if
    end do

    print'(i0)',result
end program ABC068B