object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val multplesOf2 = 1 #:: Stream.from(1).map(math.pow(2, _).toInt)
  println(multplesOf2.takeWhile(_ <= n).last)
}