#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long int ll;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector<bool> vb;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef vector<vi> vvi;
#define lowbit(S) ((S)& -(S))
#define pb push_back
#define sz(x) ((int)(x.size()))
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define bitcount __builtin_popcount
class FenwickTree{
private:
vll ft;
void build(const vll& f){
int m = sz(f) - 1;
ft.assign(m + 1, 0);
for (int i = 1; i <= m; ++i){
ft[i] += f[i];
if (i + lowbit(i) <= m) ft[i + lowbit(i)] += f[i];
}
}
public:
FenwickTree(int m){ft.assign(m + 1, 0);}
FenwickTree(const vll& f){
int m = sz(f) - 1;
ft.assign(m + 1, 0);
build(f);
}
void update(int i, ll val){
while (i < sz(ft)){
ft[i] += val;
i += lowbit(i);
}
}
ll rsq(int i){
ll sum = 0;
while (i){sum += ft[i]; i -= lowbit(i);}
}
ll rsq(int i, int j){return rsq(j) - rsq(i - 1);}
};
int numFactors(int x){
int result = 2;
for (int i = 2; i <= x / i; ++i){
if (x % i == 0){
if (x / i != i) result += 1;
result += 1;
}
}
return result;
}
vi sieveFactors(int x){
vi result(x + 1, 0);
for (int i = 1; i <= x; ++i){
for (int j = i; j <= x / i; ++j){
result[j * i] += 1;
}
}
return result;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
/*
int n = 2e9;
vi a= sieveFactors(n);
vi result;
cout << sz(a) << endl;
int maxx = 1;
for (int i = 1; i <= n; ++i){
if (maxx < a[i]){
result.pb(i);
maxx = a[i];
}
}
cout << sz(result) << endl;
for (auto x : result) cout << x << ",";*/
set<int> sett{1, 2, 4, 6, 12,24,36,60,120,180,240,360,720,840,1260,1680,2520,5040,7560,10080,15120,20160,25200,27720,45360,50400,55440,83160,110880,166320,221760,277200,332640,
498960,554400,665280,720720,1081080,1441440,2162160,2882880,3603600,4324320,6486480,7207200,8648640,10810800,14414400,17297280,21621600,32432400,36756720,43243200,
61261200,73513440,110270160,122522400,147026880,183783600,245044800,294053760,367567200,551350800,698377680,735134400,1102701600,1396755360};
int n;
cin >> n;
auto t = sett.lower_bound(n);
if (t == sett.end() || *t > n) --t;
cout << *t << endl;
return 0;
}