from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



n = inp()

res = 0

cc = 0

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

    tmp = i

    cnt = 0

    while True:

        if tmp%2==0:

            tmp //= 2

            cnt += 1

        else:

            break

    if cnt >= cc:

        cc = cnt

        res = i

print(res)      
from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

import sys,bisect,math,itertools,fractions

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))



n = inp()

now = 1

while True:

    if now*2 > n:

        print(now)

        break

    now *= 2



from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools

sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


n = inp()
res = 0
cc = 0
for i in range(1, n + 1):
    tmp = i
    cnt = 0
    while True:
        if tmp % 2 == 0:
            tmp //= 2
            cnt += 1
        else:
            break
    if cnt >= cc:
        cc = cnt
        res = i
print(res)

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions

sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


n = inp()
now = 1
while True:
    if now * 2 > n:
        print(now)
        break
    now *= 2

-import sys, bisect, math, itertools +import sys, bisect, math, itertools, fractions +INF = float("inf") -def inpln(n): -    return list(int(sys.stdin.readline()) for i in range(n)) - - -res = 0 -cc = 0 -for i in range(1, n + 1): -    tmp = i -    cnt = 0 -    while True: -        if tmp % 2 == 0: -            tmp //= 2 -            cnt += 1 -        else: -            break -    if cnt >= cc: -        cc = cnt -        res = i -print(res) +now = 1 +while True: +    if now * 2 > n: +        print(now) +        break +    now *= 2