let n = read_int ()
let rec f n = if n mod 2 = 1 then 0 else 1 + f (n / 2)
let ans, m = ref 1, ref 0
let _ = for i = 1 to n do let c = f i in if c > !m then (m := c; ans := i) done; Printf.printf "%d\n" !ans