x = "111111110000000"
n = int(input())
res = 0
while True:
if n % int(x, 2) == 0:
print(int(x, 2))
break
x = x[1:-1]
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
#include<stdio.h>
#include<string.h>
#include<bitset>
#include <map>
#include <unordered_map>
#include <stack>
#include <set>
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#define sobhi ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define mod 1000000007
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
//*************************************************************************************//
#define ll long long
#define fixed(n) cout << fixed << setprecision(n);
#define test() ll t;cin>>t;while(t--)
#define v vector
#define so(vec) sort(vec.begin(), vec.end());
#define all(vec) vec.begin(), vec.end()
#define rall(x) (x).rbegin(), (x).rend()
#define sor(arr,n) sort(arr, arr+n);
#define for0(i,n) for (ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define i(l,n,s) for (ll i = l; i < n; i+=s)
#define j(l,n,s) for (ll j = l; j < n; j+=s)
#define ri(l,n,s) for (ll i = n; i >=l; i-=s)
#define rj(l,n,s) for (ll j = n; j >=l; j-=s)
const ll MAX = 1e5 + 7;
template <typename T> istream& operator>>(istream& in, vector <T>& a) { for (auto& i : a) in >> i; return in; }
template <typename T> ostream& operator<<(ostream& out, vector <T>& a) { for (auto& i : a) out << i << " "; return out; }
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string number = "0123456789";
v<ll>a[MAX];
bool vis[MAX];
ll c, d;
//void dfs(int node)
//{
// vis[node] = 1;
// i(0, adj[node].size(), 1)
// {
// int n = adj[node][i];
// if (!vis[n])dfs(n);
// }
//}
void dfs(int u)
{
vis[u] = 1;
for0(i, a[u].size())
{
ll x = a[u][i];
if (vis[x])
{
d = 1;
break;
}
else
{
c++;
dfs(x);
}
}
}
ll fact(ll n) {
if (n == 0 || n == 1)return n;
return n * fact(n - 1);
}
ll gcd(ll a, ll b) {
return ((b == 0) ? a : gcd(b, a % b));
}
int com(pair<int, int>& a, pair<int, int>& b) {
return a.second > b.second;
}
int main()
{
//freopen("flips.in", "r", stdin);
//freopen("output.txt", "w", stdout);
sobhi
ll n; cin >> n;
ll k = 1,tmp=1,ans=1;
while (n >= tmp)
{
if (n % tmp == 0)
ans = tmp;
k++;
tmp = (pow(2, k) - 1) * (pow(2, k - 1));
}
cout << ans;
return 0;
}
429. N-ary Tree Level Order Traversal | 739. Daily Temperatures |
647. Palindromic Substrings | 583. Delete Operation for Two Strings |
518. Coin Change 2 | 516. Longest Palindromic Subsequence |
468. Validate IP Address | 450. Delete Node in a BST |
445. Add Two Numbers II | 442. Find All Duplicates in an Array |
437. Path Sum III | 436. Find Right Interval |
435. Non-overlapping Intervals | 406. Queue Reconstruction by Height |
380. Insert Delete GetRandom O(1) | 332. Reconstruct Itinerary |
368. Largest Divisible Subset | 377. Combination Sum IV |
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |
238. Product of Array Except Self | 229. Majority Element II |
222. Count Complete Tree Nodes | 215. Kth Largest Element in an Array |