#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=1;i<n;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) REP(i,v.size())cout<<#v<<"["<<i<<"]: "<<v[i]<<endl
#define ALL(a) (a).begin(),(a).end()

int check(int x){
  int result = 1;
  for(int i=2;i*i<=x;++i){
    if(x%i!=0)continue;
    int tmp = 1;
    while(x%i==0){
      x/=i;
      ++tmp;
    }
    result *= tmp;
  }
  if(x!=1)result *= 2;
  return result;
}

int main(){
  int N;
  cin >> N;
  int i = 1;
  while(true){
    int res = check(i);
    if(res==N){
      cout << i << endl;
      break;
    }
    ++i;
  }
  return 0;
}