import java.util.Scanner object Main extends App { val sc = new Scanner(System.in) val n = BigInt(sc.next) println((0 to 60).toList.map(a => scala.math.pow(2, a).toInt).filter(a => a <= n).max) }