#include #include #define rep(i,a,b) for(int i=(a);i<(b);i++) #define ll long long using namespace std; int main(void) { ll N; cin >> N; ll t = N; if(N >= 10000) t = sqrt(static_cast(N)); int ans = 0; rep(i,3,t) { if(!(N%i)) { ans = i; break; } } if(!ans) { if(!(N%2) && N/2 > 2) cout << N/2 << endl; else cout << N << endl; } else cout << ans << endl; return 0; }