#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
long long n, maxd, ans;
int prime[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41};
void dfs(int x, long long sum, long long nowd, long long Limit) {
if (nowd > maxd || (nowd == maxd && sum < ans))
maxd = nowd, ans = sum;
if (x > 11) return;
for (int i = 1; sum * prime[x] <= n && i <= Limit; i++)
dfs(x + 1, sum *= prime[x], nowd * (i + 1), i);
}
int main()
{
//freopen("divisors.in","r",stdin);
//freopen("divisors.out","w",stdout);
cin >> n;
ans = 1;
if (n > 1) dfs(1, 1, 1, 1e9);
cout << ans << endl;
return 0;
}