Recently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary representation consists of *k* + 1 consecutive ones, and then *k* consecutive zeroes.

Some examples of beautiful numbers: 
 -  1<sub class="lower-index">2</sub> (1<sub class="lower-index">10</sub>); -  110<sub class="lower-index">2</sub> (6<sub class="lower-index">10</sub>); -  1111000<sub class="lower-index">2</sub> (120<sub class="lower-index">10</sub>); -  111110000<sub class="lower-index">2</sub> (496<sub class="lower-index">10</sub>). 
More formally, the number is beautiful iff there exists some positive integer *k* such that the number is equal to (2<sup class="upper-index">*k*</sup> - 1) * (2<sup class="upper-index">*k* - 1</sup>).

Luba has got an integer number *n*, and she wants to find its greatest beautiful divisor. Help her to find it!
The only line of input contains one number *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) — the number Luba has got.
none
3
1
992
496
81142
1
76920
120
2016
2016
1
1
6
6
32640
32640
12096
2016
55948
1
47262
6
22876
28
96120
120
42160
496
38304
2016
89408
8128
97920
32640
55493
1
38021
1
21445
1
100000
1
497
1
240
120
21204
6
65536
1
364
28
1024
1
36
6
28
28
14400
120
10080
2016
9
1
2
1
42
6
83160
120
65534
1
1026
6
1025
1
1027
1
2018
1
2020
1
123
1
150
6
5
1
66
6
12768
28
156
6
99990
6
248
1
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def STRING(): return input()
from heapq import heappop , heappush
from bisect import *
from collections import deque , Counter
from math import *
from itertools import permutations
dx = [-1 , 1 , 0 , 0  ]
dy = [0 , 0  , 1  , - 1]
#visited = [[False for i in range(m)] for j in range(n)]

def f(n):
    d = ''
    while n >0 :
        x = n % 2
        d+=str(x)
        n //= 2
    return d[::-1]


def d(n):
    d =deque()
    i = 1
    while i * i <= n :
        if n%i==0:
            if n//i==i:
                d.append(i)
            else:
                d+=[i , n //i]
        i+=1
    return d

def check(s):
    r1 = s.find('1')
    r2 = s.rfind('1')
    cnt0 = 0
    cnt1 = 0
    s2 = list(s)
    for i in range(r1 , r2+1):
        if s2[i] == '1':cnt1 +=1
        else:cnt0 +=1
    cnt02 = s.count('0')
    if cnt0 == 0 and cnt02 + 1 == cnt1:
        return True
    return False

n = INT()
r1 = d(n)
z = []

for i in r1:
    x = f(i)
    y = check(x)
    if y :
        z.append(i)

z = list(reversed(sorted(z)))
#print(z)
print(z[0])