#include<bits/stdc++.h>
using namespace std;
int zhi(int n){
int i,j;
for(i=n;i>=n/2;i--){
if(n%i!=0)
continue;
else{
if(i==2)
return 2;
else{
for(j=2;j<=i-1;j++){
if(i%j==0)
break;
else
continue;
}
if(j==i){
return i;
break;}
}
}
}
}
int main()
{
int n;
cin>>n;
cout<<zhi(n);
return 0;
}