#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
ll s=0;
bool f=0;
char ch=' ';
while(!isdigit(ch))
{
f|=(ch=='-'); ch=getchar();
}
while(isdigit(ch))
{
s=(s<<3)+(s<<1)+(ch^48); ch=getchar();
}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<0)
{
putchar('-'); x=-x;
}
if(x<10)
{
putchar(x+'0'); return;
}
write(x/10);
putchar((x%10)+'0');
return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
const int Prime[]={0,2,3,5,7,11,13,17,19,23,29};
ll n;
ll ans_Num=0,ans_Ges=0;
inline void dfs(int Now,ll Ges,ll Num,int Up)
{
if(Ges>ans_Ges)
{
ans_Num=Num; ans_Ges=Ges;
}
else if(Ges==ans_Ges&&Num<ans_Num)
{
ans_Num=Num;
}
int i;
for(i=1;i<=Up;i++)
{
Num*=Prime[Now];
if(Num>n) return;
dfs(Now+1,Ges*(i+1),Num,i);
}
}
int main()
{
R(n);
dfs(1,1,1,31);
Wl(ans_Num);
return 0;
}