f=lambda n:n<1or f(n/2)*2 while 1:print f(input())