#include #include using namespace std; typedef long long ll; ll solve(ll N){ vector divisors; for(ll d=1;d*d<=N;d++){ if(N % d == 0){ divisors.push_back(d); if(N / d != d){ divisors.push_back(N / d); } } } ll res = N; for(ll d : divisors){ if(d > 2){ res = min(res, d); } } return res; } int main(){ ll N; cin >> N; cout << solve(N) << endl; return 0; }