import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt

  val res = ( 1 to n).foldLeft((1, 0)){case ((max, maxV),k) =>
    val v = loop(k,0)
    if(maxV < v) (k,v) else (max,maxV)
  }._1

  println(res)



  def loop(num: Int, cnt:Int): Int ={
    if(num % 2 != 0) cnt else loop(num / 2, cnt + 1)
  }


}