use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut a = Vec::new(); let mut bit = n; while bit > 0 { a.push(bit); bit = (bit - 1) & n; } a.sort(); println!("{}", a[a.len() / 2]); }