N = int(eval(input()))



ans = 1

while ans * 2 <= N:

    ans *= 2



print (ans)
N = int(eval(input()))



ans = 0

count = 0

for i in range(1, N + 1):

    tmp = 0

    j = i

    while j % 2 == 0:

        j //= 2

        tmp += 1

    

    if tmp >= count:

        count = tmp

        ans = i

    

print (ans)
N = int(eval(input()))
ans = 1
while ans * 2 <= N:
    ans *= 2
print(ans)

N = int(eval(input()))
ans = 0
count = 0
for i in range(1, N + 1):
    tmp = 0
    j = i
    while j % 2 == 0:
        j //= 2
        tmp += 1
    if tmp >= count:
        count = tmp
        ans = i
print(ans)

-ans = 1 -while ans * 2 <= N: -    ans *= 2 +ans = 0 +count = 0 +for i in range(1, N + 1): +    tmp = 0 +    j = i +    while j % 2 == 0: +        j //= 2 +        tmp += 1 +    if tmp >= count: +        count = tmp +        ans = i