import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))



    res = 0

    ans = 0

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

        n = int(str(i)[::])

        cnt = 0

        while n % 2 == 0:

            n //= 2

            cnt += 1



        if res <= cnt:

            res = cnt

            ans = i

    print(ans)





if __name__ == '__main__':

    resolve()

import sys

from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

input = sys.stdin.readline

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))



    res = defaultdict(int)

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

        cnt = 0

        k = i

        while k % 2 == 0:

            k //= 2

            cnt += 1

        res[i] = cnt



    ma = 0

    ans = 1

    for k, v in list(res.items()):

        if ma < v:

            ans = k

            ma = v



    print(ans)





if __name__ == '__main__':

    resolve()

import sys

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


def resolve():
    n = int(eval(input()))
    res = 0
    ans = 0
    for i in range(1, n + 1):
        n = int(str(i)[::])
        cnt = 0
        while n % 2 == 0:
            n //= 2
            cnt += 1
        if res <= cnt:
            res = cnt
            ans = i
    print(ans)


if __name__ == "__main__":
    resolve()

import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    n = int(eval(input()))
    res = defaultdict(int)
    for i in range(1, n + 1):
        cnt = 0
        k = i
        while k % 2 == 0:
            k //= 2
            cnt += 1
        res[i] = cnt
    ma = 0
    ans = 1
    for k, v in list(res.items()):
        if ma < v:
            ans = k
            ma = v
    print(ans)


if __name__ == "__main__":
    resolve()

+from collections import defaultdict +input = sys.stdin.readline -    res = 0 -    ans = 0 +    res = defaultdict(int) -        n = int(str(i)[::]) -        while n % 2 == 0: -            n //= 2 +        k = i +        while k % 2 == 0: +            k //= 2 -        if res <= cnt: -            res = cnt -            ans = i +        res[i] = cnt +    ma = 0 +    ans = 1 +    for k, v in list(res.items()): +        if ma < v: +            ans = k +            ma = v