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 MAP2():return map(float,input().split())
def LIST(): return list(map(int, input().split()))
def STRING(): return input()
import string
import sys
from heapq import heappop , heappush
from bisect import *
from collections import deque , Counter , defaultdict
from math import *
from itertools import permutations , accumulate
dx = [-1 , 1 , 0 , 0  ]
dy = [0 , 0  , 1  , - 1]
#visited = [[False for i in range(m)] for j in range(n)]
#sys.stdin = open(r'input.txt' , 'r')
#sys.stdout = open(r'output.txt' , 'w')
#for tt in range(INT()):


#CODE
def binarry(n):
    ans = []
    while n > 0 :
        ans.append(n % 2)
        n//=2

    res = ''
    for i in range(len(ans)-1 , -1,-1):
        res += str(ans[i])

    return res

def solve(n):
    d = []
    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

n = INT()
d = solve(n)
d.sort(reverse= True)
ans = -1

for i in d :
    x = binarry(i)
    c1 , c0 = 0 , 0
    for j in x :
        if j == '1':
            c1+=1
        else:
            c0 +=1

    if c1 == c0 + 1 :
        ans = i
        break

print(ans)




