#include<bits/stdc++.h>
using namespace std;
int main()
{
int tot,n,tot1=0;
cin>>n;
for(int k=2;k<n;k++){
if(n%k==0) tot1++;
}
if(tot1==0){
cout<<fixed<<setprecision(0);
cout<<pow(2,n-1);
return 0;
}
for(int i=n;;){
tot=1;
for(int k=1;k*2<=i;k++){
if(i%k==0) tot++;
}
if(tot!=n){
i++;
continue;
}
cout<<i;
return 0;
}
}