#include #define EM 1000000 using namespace std; using LL = long long; using P = pair; LL LINF = 1e18; int INF = 1e9; LL mod = 1e9+7; using vint = vector; using vLL = vector; using vvint = vector>; using vvLL = vector>; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int main(){ LL N; cin >> N; // LL ans = 0; // for(LL i = 3;i*i <= N;i++){ // if(N%i == 0){ // ans = i; // break; // } // } // if(ans == 0){ // if(N%4 == 0) ans = 4; // else if(N%2 == 0) ans = N/2; // else ans = N; // } // cout << ans << endl; vector l; for(LL i = 1;i*i <= N;i++){ if(N%i == 0) { l.push_back(i); l.push_back(N/i); } } sort(l.begin(), l.end()); for(auto a : l){ if(a > 2) { cout << a << endl; break; } } }