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