fun main(array: Array<String>) {
    val n = readLine()!!.toInt()
    var max = 0
    var ans = 0

    if(n == 1) {
        print(1)
        return
    }

    for(i in 2 until n+1) {
        var a = i
        var cnt = 0
        while (a % 2 != 1) {
            a /= 2
            cnt++
        }
        if(max <= cnt) {
            max = cnt
            ans = i
        }
    }
    print(ans)
}