fun main(args: Array<String>) = println((1..readLine()!!.toInt()).filter { div2Completely(it) }.max() ?: 1)

private fun div2Completely(n: Int): Boolean = when {
    n % 2 != 0 -> false
    n > 2 -> div2Completely(n / 2)
    else -> true
}