import Foundation

let n = Int(readLine()!)!
var ans = 1
var count = 0
for i in 1...n {
  var div = i
  var c = 0
  while div % 2 == 0 {
    c += 1
    div /= 2
  }
  if count < c {
    ans = i
    count = c
  }
}
print(ans)