#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int S=0,Smax=0,n,i,k;
cin>>n;
for(int i=1;i <= n;i++)
{
S=0;
for(int j=1;j <= n;j++)
{
if(i%j == 0)
S=S+j;
if(S > Smax){Smax=S;k=i;}
}
}
cout<<k;
return 0;
}