N=int(eval(input()))

ans=1

while ans*2 <= N:

    ans*=2

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

c = 0

ans = 1

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

    n = i

    for t in range(N + 1):

        if n % 2 != 0:

            if c < t:

                c = t

                ans = i

            break

        n //= 2

print(ans)

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

N = int(eval(input()))
c = 0
ans = 1
for i in range(1, N + 1):
    n = i
    for t in range(N + 1):
        if n % 2 != 0:
            if c < t:
                c = t
                ans = i
            break
        n //= 2
print(ans)

+c = 0 -while ans * 2 <= N: -    ans *= 2 +for i in range(1, N + 1): +    n = i +    for t in range(N + 1): +        if n % 2 != 0: +            if c < t: +                c = t +                ans = i +            break +        n //= 2