def ascan; gets.split.map(&:to_i);end N = gets.to_i l = 2**(N.bit_length) if l/2 == N p N.bit_length-1 else p N.bit_length + (l-N) end