'use strict'

function main(input) {
  const n = Number(input)
  let ans = 0
  if (n == 1) {
    console.log(1)
    return
  }
  let i = 0
  while (Math.pow(2, i+1) <= n) {
    i++
    ans = Math.pow(2, i)
  }
 
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))