#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
vector<long long>f;
int main(){
	long long a;scanf("%lld",&a);
	for(int i=1;(long long)i*i<=a;i++){
		if(a%i==0){
			f.push_back(i);
			f.push_back(a/i);
		}
	}
	std::sort(f.begin(),f.end());
	for(int i=0;i<f.size();i++){
		if(f[i]==1||f[i]==2)continue;
		printf("%lld\n",f[i]);return 0;
	}
}