N = int(eval(input()))

result = 1

count = 0

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

  a = i

  n = 0

  while a % 2 == 0:

    a /= 2

    n += 1

  if  n > count:

    result = i

    count = n

print(result)

n = int(eval(input()))

ans = 1

while ans <= n:

    ans *= 2

print((ans // 2))

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

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

-N = int(eval(input())) -result = 1 -count = 0 -for i in range(1, N + 1): -    a = i -    n = 0 -    while a % 2 == 0: -        a /= 2 -        n += 1 -    if n > count: -        result = i -        count = n -print(result) +n = int(eval(input())) +ans = 1 +while ans <= n: +    ans *= 2 +print((ans // 2))