import sys
import re

lines = []
for line in sys.stdin:
    lines.append(line)

assert len(lines) == 1
assert re.fullmatch(r"[1-9]\d*\n", lines[0])
N = int(lines[0])
assert 1 <= N < 2 ** 60

for i in reversed(range(60)):
    if N & (1 << i):
        ans = 1 << i
        print(ans)
        break