'use strict'

function main(input) {
  const n = Number(input)
  let ans = 0
  let tmpmax = 0
  if (n == 1) {
    console.log(1)
    return
  }
  for (let i = 1; i <= n; i++) {
    if (i % 2 > 0) {
      continue
    } else {
      //何回割り切れるか
      let j = i
      let cnt = 0
      while (j % 2 == 0) {
        cnt++
        j = j / 2
      }
      if (tmpmax < cnt) {
        tmpmax = cnt
        ans = i
      }
    }
  }

  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))